-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Potentially spurious exhaustivity warning when matching on a type with contravariant type param #15967
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
Calling |
It might be the case that the calculated spaces are correct in theory, but because the test for |
Yeah, the space engine doesn't seem to take in consideration that we want to ignore the type argument component. |
I agree that no exhaustivity warning should be issued, regardless of whether
(Perhaps 1 merely restates @prolativ, and 2 merely restates @KacperFKorban.) |
Not doing so, in a context where GADT inferrence is enabled, such as in TypeOps.refineUsingParent, leads to false inferrences. Doing so, and removing the previous fix for scala#15967, fixes the regression in scala#16339, and keeps scala#15967 as well as scala#16123 (which is somewhat related) fixed.
Not doing so, in a context where GADT inferrence is enabled, such as in TypeOps.refineUsingParent, leads to false inferrences. Doing so, and removing the previous fix for scala#15967, fixes the regression in scala#16339, and keeps scala#15967 as well as scala#16123 (which is somewhat related) fixed.
Compiler version
3.2.1-RC1-bin-20220831-398b72e-NIGHTLY
compiles without warnings with
3.2.0-RC1
Minimized code
Output
Expectation
No warning. (possibly)
I'm not 100% sure if the warning is correct or not. But this is a CB (#15949) fail, so decided to create an issue either way.
My reasoning is: Since
C.U
is invariant andT.U
is contravariant, then the match can still fail onC[Any]
.Though scala
2.13.8
doesn't give a warning here.The text was updated successfully, but these errors were encountered: