-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Analyzer: null.foo reports no warning #27273
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 guess you want to enable strong mode https://www.dartlang.org/guides/language/analysis-options |
See also #27276 |
I'm guessing this is what triggered #27276 We need to fix this somehow, likely by special casing again to say that calling members of bottom is only allowed if they are also members on |
cc @lrhn @eernstg @munificent @floitschG Should Null allow all methods, or should we forbid this? |
The That doesn't completely avoid the problem because |
Currently both strong and non-strong mode allow this code with no errors: import 'dart:async';
main() {
Future<Null> f;
f.then((x) => x.length);
} Do we view this as an implementation bug? WAI? Or something we need to sort out? |
Non-strong-mode is unsurprising, the static type of Strong mode is wrong. Inference should make import 'dart:async';
main() {
Future<Null> f;
f.then((Null x) => x.length);
} you should get a warning in non-strong mode (and probably an error in strong mode). A quick check in dartpad shows that there is no warning, not even in non-strong mode, so yes, I think we do have an analyzer bug here. |
The new front end implements the correct behavior for this. Re-assigning this as an analyzer bug. |
This seems to be fixed. |
Correction, the original issue still reproduces on recent bleeding edge. Calling a method on something of type |
This was fixed at some point recently; Dart analyzer 2.5.0 reports:
|
The dart analyzer reports no warnings with this code:
I would expect: "The getter 'foo' is not defined for the class 'Null'."
The text was updated successfully, but these errors were encountered: