-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Spurious exhaustiveness warning for union of tuple types #8690
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
Might have the same root cause as #8681 ? |
I had a quick look and it doesn't seem easy yeah, there's various places which assume that the unapply method type is fully inferred before typing the unapply arguments, I think that part of the issue should be considered a feature request and not a bug. |
@smarter fair enough, as long as the fully-annotated version works: def test(x: (A, B) | (B, A)) = x match {
case (u: A, v: B) => (u, v)
case (u: B, v: A) => (v, u)
} (@liufengyun it would be good to test that code too.) |
@LPTK The exhaustivity check can handle the code above (thanks for the test), but in a later phase there's a warning saying:
So, you may need a |
@liufengyun isn't that warning spurious? |
Fix #8690: the signature for product should come from expected type
Minimized code
https://scastie.scala-lang.org/ifiEqLPETBq2eruEbFXfFQ
Output
Moreover, the type inferred for
v
is alwaysObject
, whereas it could be more precise here.Expectation
No warning, and more precise types.
The text was updated successfully, but these errors were encountered: