-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Dart does not recognise nullable value in extension at runtime #44558
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 never remember whether we can promote (Also, the code won't work because the empty string is not assignable to |
@irhn yep, that was an error of my own, thanks for pointing it out, instead of I don't know if |
You are right, the error is gone, thanks. Shouldn't the compiler show an error to warn the developer about this? |
I believe that there is a known issue where the analyzer incorrectly promotes Related: |
Great then. Thanks all for your fast answers, I'll close this issue as everything was solved. Happy Holidays :) |
@leafpetersen actually, it worked in the CFE, and required some additional work in the analyzer. IIRC, I prototyped a solution for the analyzer, but at the end we decided that we don't want such promotion. It seems that in the CFE promotion still works though. |
@scheglov I'm probably misremembering details. I'm pretty sure that we do want the promotion, but decided that the implementation cost was too high somewhere to do it now (perhaps the CFE only promotes |
Ah, yes, it is quite possible that |
The problem is pretty straightforward. I have the following extension:
When editing, compiler shows no error. However, the following warning appears at runtime:
(With
^
symbol pointing to the exclamation inthis![index]
).But if I actually were to remove the
!
from thethis![index]
, it would ask me to introduce the symbol again (which I think is the correct thing to do).The text was updated successfully, but these errors were encountered: