Closed
Description
Compiler version
3.3.0-RC2
Minimized code
//> using scala "3.3.0-RC2"
//> using options "-Wunused:all"
@main
def hello(): Unit =
for {
i <- (0 to 10).toList
(a, b) = "hello" -> "world"
} yield println(s"$a $b")
Output
Compiling project (Scala 3.3.0-RC2, JVM)
[warn] ./unused-bug2.scala:8:6: unused local definition
[warn] (a, b) = "hello" -> "world"
[warn] ^
[warn] ./unused-bug2.scala:8:9: unused local definition
[warn] (a, b) = "hello" -> "world"
[warn] ^
Expectation
Neither a
nor b
being marked as unused
Other
Interestingly, it doesn't happen with "normal" (i.e. not contained in for
) tuple destructuring. The following doesn't produce false positives:
//> using scala "3.3.0-RC2"
//> using options "-Wunused:all"
@main
def hello(): Unit =
val (a, b) = "hello" -> "world"
println(s"$a $b")