Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

False positive with -Wunused:imports and renamed import in same package #17117

Closed
mrdziuban opened this issue Mar 16, 2023 · 0 comments · Fixed by #17177
Closed

False positive with -Wunused:imports and renamed import in same package #17117

mrdziuban opened this issue Mar 16, 2023 · 0 comments · Fixed by #17177
Assignees
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug
Milestone

Comments

@mrdziuban
Copy link

Compiler version

3.3.0-RC3

Minimized code

https://scastie.scala-lang.org/mrdziuban/e4rXAgetT5aGQLL1zt4BJw/9

package example {
  object test1 {
    val test = "test"
  }
  object test2 {
    import example.test1 as t1
    val test = t1.test
  }
}

Output

    import example.test1 as t1
                   ^^^^^^^^^^^
                   unused import

Expectation

The import should not be reported unused since the rest of the code in object test2 fails to compile without it. This seems to only happen when the renamed import comes from the same package as the code where it's imported.

@mrdziuban mrdziuban added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 16, 2023
@nicolasstucki nicolasstucki added area:linting Linting warnings enabled with -W or -Xlint and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 16, 2023
@Kordyjan Kordyjan added this to the 3.3.0 backports milestone Mar 16, 2023
@Kordyjan Kordyjan modified the milestones: 3.3.0 backports, 3.3.1, 3.3.0 Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants