Skip to content

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

Closed
@mrdziuban

Description

@mrdziuban

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.

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions