-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Type projection is unsound #1050
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
this looks very similar to #50 |
it kind of looks like an existential whose skolem is used outside of the existential scope -- when you open |
I don't want to insist too much on this since I haven't done any more work to convince anyone except @sstucki that this makes sense, but my type projection proposal side-steps this: |
@smarter Here is the same example with aliases:
Same ClassCastException. The way I interpret your proposal it means I map the first program to the second one, no? |
Can you rewrite this using existential types and still get away with it?
|
We don't have existentials anymore. |
@odersky :
|
Sure, it was a thought experiment to see how they relate. |
EDIT: nevermind (my thinking was that the bounds should be considered together, as if they were one type, but the resulting thought was not fully formed -- I'll leave it for the record :-)).
|
@smarter No, in the example Int needs to be a subtype of the lower bound, |
It looks like we have three possible set of rules, which look a bit like this (very approximately):
|
Right, that's different from what would happen in my proposal where |
(Note that I withdrew my proposal ;-) |
How is that different from what we're doing now? In both scalac and dotty, if you write |
Closed by way of #1051 |
The following program compiles and throws a ClassCastException when executed. One might be tempted to try to rule out the obviously bad intersection
T & U
but we know from our work on DOT that there are ways to engineer bad bounds that cannot be detected locally. So the culprit is the projectionX#A
.The text was updated successfully, but these errors were encountered: