-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Analyzer crash when !
is applied to a null-shorting expression
#43093
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
(What do you mean by |
Hmm, I admit that I didn't read the spec for this; I tested the behavior of the CFE and assumed it was correct. AFAICT, the CFE treats I went back and re-read https://github.com/dart-lang/language/blob/master/accepted/future-releases/nnbd/feature-specification.md#null-aware-operator, and I think this behavior is consistent with it; there's no rule in that section giving special handling of to postfix My concern if we decide to have |
@eernstg We have formally specified null shortening now, right? I definitely do not want x?.foo?.bar; and
to behave differently when |
Given that
|
I believe this would ensure that Also, it seems less useful to let |
Proposed spec update here. |
@lrhn @eernstg I'm going to move further discussion of the language change to a language issue, so that I can mark this bug as fixed when I get rid of the analyzer crash. Moved to dart-lang/language#1163 |
The following code is accept without complaint by the VM but crashes the analyzer:
I believe what is happening is that the analyzer gets confused about whether the
!
should terminate null shorting (it should), and as a result break invariants of flow analysis; this in turn causes a crash when it tries to close the "then" branch of the "if" statement. I'm preparing a fix.The text was updated successfully, but these errors were encountered: