-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:lintingLinting warnings enabled with -W or -XlintLinting warnings enabled with -W or -Xlintitype:bug
Description
Compiler version
This occurs in 3.8.0 and 3.8.1, but not in 3.7.4
Minimized code
//> using scala 3.8.0
//> using option -language:strictEquality
//> using option -Wunused:all
case class Foo(value: String)
case object Bar
object Import {
given CanEqual[Foo | Bar.type, Foo | Bar.type] = CanEqual.derived
}
@main
def main(): Unit = {
import Import.given
val i: Foo | Bar.type = Foo("Foo")
i match {
case i: Foo => println("i is a Foo")
case Bar => println("i is a Long")
}
}Output
[warn] ./unused.scala:14:17
[warn] unused import
[warn] import Import.given
[warn] ^^^^^
i is a FooExpectation
No warning. Omitting the import Import.given causes a compile error, so it is not unused. This worked as expected in 3.7.4
Metadata
Metadata
Assignees
Labels
area:lintingLinting warnings enabled with -W or -XlintLinting warnings enabled with -W or -Xlintitype:bug