We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tested on Scala 2.12.8 and 2.13.0-M5.
Compiling this object with -Ywarn-unused:patvars
-Ywarn-unused:patvars
object Warnings { case class Foo(bar: Int, buzz: String) def test = for { foo @ Foo(bar, buzz) <- List(Foo(1, "x")) x = s"$bar $buzz $foo" } yield x def main(args: Array[String]) = println(test) }
results in a warning:
pattern var foo in value $anonfun is never used; `foo@_' suppresses this warning
This is probably caused by desugaring of the above for-comprehension, being roughly:
List(Foo(1, "x")).map({ case (foo @ Foo((bar @ _), (buzz @ _))) => val x = StringContext("", " ", " ", "").s(bar, buzz, foo); (foo, x) }).map({ case ((foo @ Foo((bar @ _), (buzz @ _))), (x @ _)) => x }));
Note that exact same pattern used in first map is carried over to the second map, even though now its variables aren't used.
map
The text was updated successfully, but these errors were encountered:
This duplicates #10287 where, as you note, the desugaring makes it too much of a bother. Leaving open to track use cases (test cases).
Sorry, something went wrong.
consolidating at #10287
No branches or pull requests
Tested on Scala 2.12.8 and 2.13.0-M5.
Compiling this object with
-Ywarn-unused:patvars
results in a warning:
This is probably caused by desugaring of the above for-comprehension, being roughly:
Note that exact same pattern used in first
map
is carried over to the secondmap
, even though now its variables aren't used.The text was updated successfully, but these errors were encountered: