-
-
Notifications
You must be signed in to change notification settings - Fork 658
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
Type of foo ?? throw bar
is Null<Foo>
instead of Foo
#10771
Comments
I agree the type should be non-null if possible. It's a bit tricky to handle for various scenarios, including nullable right-hand and abstract casts, but we should look into it. |
Did we ever discuss what should happen for something like The current implementation of |
I think On other languages you mostly see var a = null;
a = 1;
$type(a); // Int See this issue: #7736 So you probably cannot generate |
The type of
x ?? throw "error"
does not equal the non-null type of x.Example code:
Expected output:
String
Actual output:
Null<String>
Looking at #10745 this seems to be intentional which is odd.
throw
does not yield a value (same forreturn
,break
, andcontinue
), so I would expect the result to be non-null.The text was updated successfully, but these errors were encountered: