-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Unsoundness when inheriting conflicting type parameters #3989
Comments
Discussion leading to this ticket: https://gitter.im/lampepfl/dotty?at=5a81a707e217167e2c742a4f |
The second one seems GADT-unrelated. I disagree on “conflicting”: Maybe defining |
@Blaisorblade paper is a recommended read for this: http://lampwww.epfl.ch/%7Ehmiller/scala2013/resources/pdfs/paper5.pdf, section 4.3 gives some suggestions on how to fix this. class C[X](x: Any) extends B[Any](x) with A[X] This will probably prevent some legitimate usecases but that's a small price to pay for soundness. |
Finally found the old discussion on covariant type refinement for members. Back then it was unclear whether the expressiveness loss was tolerable. No clue how all this has evolved. |
This fixes the second half of scala#3989. Some tests had to be updated or re-classified because they were unsound before.
This fixes the second half of scala#3989. Some tests had to be updated or re-classified because they were unsound before.
Plugging the soundness hole in scala#3989 unveiled problems in the strawman. These need to be fixed before we can test it again in dotty.
Plugging the soundness hole in scala#3989 unveiled problems in the strawman. These need to be fixed before we can test it again in dotty.
Fix #3989: Fix several unsoundness problems related to variant refinement
This compiles without warnings in both Dotty master and Scala 2.12:
There used to be unsoundness warnings but they are gone since (presumably) #3918 even though the pattern match is unsound.
Furthermore the following compiles without warnings:
In this case, which doesn't rely on pattern matching, the definition of
C
itself is unsound but Dotty accepts it anyway. Scala 2.12 rightfully complains:The text was updated successfully, but these errors were encountered: