-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
non-nullable promotion on assignment not working #39562
Comments
cc @lrhn this is expected to work, right? |
I expect it to work, and I'm hitting it now while migrating Being nullable is always "interesting". A lot of code paths have a shape like: Foo? something;
if (somethingElse) {
something = computeFoo();
bar = something.whatnot();
} It's too annoying to have to introduce a new variable when you already have a local variable. |
Agreed. The non-nullable analogue of the declared type needs to be a type of interest. This is on my list to work on. |
This pattern came up a bunch when migrating dart:io and the code could be made nicer once this feature is implemented. |
Bug: #39562 Change-Id: Id55224199f64a8f01b14937ddda6963aff24140c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143661 Reviewed-by: Paul Berry <paulberry@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
main.dart:
The text was updated successfully, but these errors were encountered: