Skip to content

-Wunused:imports gives false positive when importing from a val #16930

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

Closed
SethTisue opened this issue Feb 16, 2023 · 0 comments · Fixed by #16939
Closed

-Wunused:imports gives false positive when importing from a val #16930

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

Comments

@SethTisue
Copy link
Member

//> using scala "3.3.0-RC2"
//> using option "-Wunused:imports"

trait Outer:
  trait Used
  trait Unused

trait Test:
  val outer: Outer
  import outer.{Used, Unused}
  def foo(x: Any): Boolean =
    x.isInstanceOf[Used]

actual behavior (the first warning is a false positive):

[warn] ./S.scala:10:17: unused import
[warn]   import outer.{Used, Unused}
[warn]                 ^^^^
[warn] ./S.scala:10:23: unused import
[warn]   import outer.{Used, Unused}
[warn]                       ^^^^^^

expected behavior (I should only get the true positive):

[warn] ./S.scala:10:23: unused import
[warn]   import outer.{Used, Unused}
[warn]                       ^^^^^^
@SethTisue SethTisue added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label area:linting Linting warnings enabled with -W or -Xlint labels Feb 16, 2023
@WojciechMazur WojciechMazur removed the stat:needs triage Every issue needs to have an "area" and "itype" label label Feb 16, 2023
@KacperFKorban KacperFKorban self-assigned this Feb 16, 2023
KacperFKorban referenced this issue in dotty-staging/dotty Feb 16, 2023
KacperFKorban referenced this issue in dotty-staging/dotty Feb 16, 2023
KacperFKorban referenced this issue in dotty-staging/dotty Feb 16, 2023
Kordyjan referenced this issue in dotty-staging/dotty Apr 13, 2023
Kordyjan referenced this issue in dotty-staging/dotty Apr 14, 2023
Kordyjan referenced this issue in dotty-staging/dotty Apr 14, 2023
@Kordyjan Kordyjan modified the milestones: 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