Skip to content

Spurious unused import warnings when import of export is used in creator application #24562

@lihaoyi

Description

@lihaoyi

Compiler version

3.8.0-RC2

Minimized code

package bar{
  export scala.util.Random
}
package foo{
  import bar.Random
  def main() = {
    println(Random(null))
  }
}

Output

[warn] /Users/lihaoyi/Github/scala3/foo.scala:5:14
[warn] unused import
[warn]   import bar.Random
[warn]              ^^^^^^

Expectation

I am using Random, so the import is not unused. If I remove the import, compilation fails

This is causing problems trying to adopt creator application syntax in Mill, since it causes scalafix to incorrectly remove the relevant imports, breaking the code com-lihaoyi/mill#6257

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