You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
//>usingscala"3.3.0-RC2"//>usingoptions"-Wunused:all"@main
defhello():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:
//>usingscala"3.3.0-RC2"//>usingoptions"-Wunused:all"@main
defhello():Unit=val (a, b) ="hello"->"world"
println(s"$a$b")
The text was updated successfully, but these errors were encountered:
Compiler version
3.3.0-RC2
Minimized code
Output
Expectation
Neither
a
norb
being marked as unusedOther
Interestingly, it doesn't happen with "normal" (i.e. not contained in
for
) tuple destructuring. The following doesn't produce false positives:The text was updated successfully, but these errors were encountered: