-
Notifications
You must be signed in to change notification settings - Fork 213
Type unsafety of ?? #465
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
I suspect this is an implicit cast. The same thing could be done with: num n = 1;
String s = n == null ? List() : n; The type of the right-hand-side is the Least Upper Bound of |
Sorry, I think |
Closing this because it will get addressed by NNBD which removes implicit downcasts. |
This case won't be fixed assuming we continue to allow implicit downcast from |
reopen? |
Hmm, trying to repro I'm seeing that the type of |
This is mostly solved. The case that isn't solved is if one of elements of the lub is void main() {
dynamic y;
int x = y ?? "hello";
} |
No, |
Consider the following code
It gives an obvious runtime error.
I'm not so much interested in why it's considered a valid syntax as in getting the analyzer report this at compile time. I have bumped into this a few times too many.
The text was updated successfully, but these errors were encountered: