Skip to content

False positive unused import involving type alias and extractor #22787

Closed
@SethTisue

Description

@SethTisue

Compiler version

3.6.4 (and also the current 3.7 nightly)

Minimized code

//> using scala 3.nightly
//> using option -Wunused:imports

object tpd:
  type Block = Trees.Block

object Trees:
  case class Block(x: Int)

trait Bug:
  import tpd.Block
  def foo: Unit =
    (??? : Any) match
      case Block(_) =>

Output

[warn] ./S.scala:11:14
[warn] unused import
[warn]   import tpd.Block
[warn]              ^^^^^

Expectation

The import is used. The code does not compile without it. The type alias must be confusing the compiler.

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