Skip to content

Wunused:imports false positive, wrong import scope #21917

Closed
@gaelrenoux

Description

@gaelrenoux

Compiler version

3.5.2

Minimized code

import Dog.Owner

class Dog(owner: Owner) {
  import Dog.*
  
  val getOwner: Owner = owner
}

object Dog {
  class Owner
}

Output

[warn] -- [E198] Unused Symbol Warning: /home/gael/Repositories/Gael/bug-reproduction/import-failure/src/main/scala/Dog.scala:1:11 
[warn] 1 |import Dog.Owner
[warn]   |           ^^^^^
[warn]   |           unused import
[warn] one warning found

Expectation

Import should not be reported. Removing the import makes the compilation fail, as expected. Removing the internal import import Dog.* makes the message disappear.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:lintingLinting warnings enabled with -W or -Xlintitype:bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions