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
List(("first", "second"))
.map { case (_, _) =>for {
a <-Some("a")
b = a // b is not used warning
} yield b
}
Problem
When using a pattern match anonymous function in a HOF, variables assigned inside
a for-comprehension(b = a) are reported as unused.
Same snippet in 2.13.14 works fine.
Explain how the above behavior isn't what you expected.
Do not report it as unused since it clearly is used
Workaround
List(("first", "second"))
.map { a =>
a match {
case (_, _) =>
for {
a <- Some("a")
b = a
} yield b
}
}
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
Reproduction steps
https://scastie.scala-lang.org/LI6ZuhHfS3CjvYepfhJjyw
Scala version: 2.13.15 with
"-Ywarn-unused"
flag(Is the bug only in Scala 3.x? If so, report it at scala/scala3 instead.)
Problem
When using a pattern match anonymous function in a HOF, variables assigned inside
a for-comprehension(b = a) are reported as unused.
Same snippet in 2.13.14 works fine.
Explain how the above behavior isn't what you expected.
Do not report it as unused since it clearly is used
Workaround
The text was updated successfully, but these errors were encountered: