-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Don't simplify |/& by taking lubs/glbs for explicitly declared types. #885
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
Conversation
A lub might return a different type (i.e. singleton types are widenened). We should not do this if the type is given explicitly.
/rebuild |
val foo: a.type | b.type = a
val bar: a.type | b.type = foo The type of the tree corresponding to
|
I think all this is correct. But what can we do? Disallow unions of On Fri, Oct 30, 2015 at 10:05 AM, Guillaume Martres <
Martin Odersky |
Well, #844 seems to work fine, do you see any cases where it might do something wrong? |
The danger with #844 is that it produces too large types and will make On Fri, Oct 30, 2015 at 10:15 AM, Guillaume Martres <
Martin Odersky |
I now believe we are on the wrong track altogether. Messing with the meaning of lubs gets us into trouble. If we want lubs to widen singleton types we have to disallow union types consisting of singleton types. Everything else would be too operational. |
A lub might return a different type (i.e. singleton types are widenened).
We should not do this if the type is given explicitly.
This is a more conservative version of #844. Review by @smarter.
@smarter can you push your tests on top of this PR? Thanks!