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
Scala version: 2.13.9 executed with -Ywarn-unused -Werror.
[info] Starting scala interpreter...
Welcome to Scala2.13.9 (OpenJDK64-BitServerVM, Java11.0.18).
Type in expressions for evaluation. Ortry:help.
scala>for { a1 <-Some(1); a2 <-Some(0); if!(a1 >10); res = a1 - a2 } yield res
^warning: parameter value a2 in anonymous function is never used
error:No warnings can be incurred under -Werror.
scala>for { a2 <-Some(0); a1 <-Some(1); if!(a1 >10); res = a1 - a2 } yield res
valres8:Option[Int] =Some(1)
Problem
This looks somewhat similar to #11343. The above statement should compile without any warning. Reordering unrelated statements fixes the error.
The text was updated successfully, but these errors were encountered:
SethTisue
changed the title
For-comprehension with Optional - incorrectly marked parameter as unused
For-comprehension with Option - incorrectly marked parameter as unused
Jan 26, 2023
Maybe I will take a swing at it when I take a last look at related warnings. Especially now that Dotty has unused warnings and we are motivated if not obligated to maintain parity.
That ticket is only 2500 tickets ago, but it feels like half a decade.
Reproduction steps
Scala version: 2.13.9 executed with
-Ywarn-unused -Werror
.Problem
This looks somewhat similar to #11343. The above statement should compile without any warning. Reordering unrelated statements fixes the error.
I've been able to reproduce it on scastie: https://scastie.scala-lang.org/fY4Fp3sAQ0unBDkf1uibdg — it seems 2.13.10 is also affected
The text was updated successfully, but these errors were encountered: