-
Notifications
You must be signed in to change notification settings - Fork 21
2.12.2 "-Ywarn-unused:patvars" false report pattern vars #10394
New issue
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
Comments
Thanks for the report. The expansion:
Maybe this is a reduction (edited):
The wildcard pattern is the escape hatch. |
Worth documenting that |
Is there any workaround? This is currently giving me issues. |
@lewis6991 The workaround is to avoid a refutable pattern in the for comprehension, or turn off the warning, Another footnote: it looks like tuple destructuring doesn't warn at all, even if the tuple vars are unused. |
Ok, thanks for the reply.
Though I don't exactly understand how you would apply this for the given error. |
I don't see a syntax to help you. The reason tuples don't warn is that they are rewritten syntactically to the escape hatch. It's the
|
This is still causing an issue for me (2.12.5). Here is a simplified test case. object ErroneousPatVarWarning {
case class A()
case class B(b: A)
def main(args: Array[String]) {
for(B(a@A()) <- Nil: List[B])
println(a)
}
}
|
@lewis6991 Thanks. scala/scala#6473 |
Som's followup fix has been merged for 2.12.6. |
The following code generates warnings under warn-unused:
Quite clearly within the block, oldPair is being used.
Full Scalac Options provided to SBT:
The text was updated successfully, but these errors were encountered: