-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Front-end UP of promoted type variables does not behave correctly. #52993
Comments
It looks like the This seems to be consistent with the behavior of the CFE when we change An underlying difficulty here could be that the nullability of types has been modeled using a bit on the (If the type variable |
Sounds reasonable. There is only one (Even if we got smarter and inferred |
That was the way we represented intersection types before. We have a dedicated |
Example:
When compiled in DartPad, I get the following errors:
This suggests that the result of UP(X&B, X&C) is a kind of "X & Object", with the "may be nullable" flag turned off (which makes a kind of sense because
X&B
andX&C
are both non-nullable), without it actually being an intersection type.It differs from the real
X
type.Now add to the above:
and we get the same errors of
X
is notX
,and the UP(X&B, X&B) appears to X, not X&B, which it should be by the (very first) reflexivity rule of UP: "UP(T, T) = T":
So, UP of promoted type variables is not doing the right thing, in two ways:
X&Object
, because it's reified as type argument.The text was updated successfully, but these errors were encountered: