-
Notifications
You must be signed in to change notification settings - Fork 1.7k
No analyzer strong mode error for void sync* and async* functions #32192
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
Note that in 9f9987f we updated the feature specification generalized-void.md to specify the following:
So the declarations of Assignability has changed because of a different change, though, so that's probably the reason why the strong mode analysis does not flag this declaration: So the Dart 2 static analysis needs to implement the (newly added) specific rule about |
@eernstg The text you refer to:
does not seem to have made it out of the generalized-void into the language spec. I see that CFE enforces this rule; the analyzer still does not. Should it? |
Good catch, thanks! We do indeed not have any warnings or errors for return type |
Thanks much! |
Thanks! The spec update dart-lang/language#1060 has landed. |
Bug: #32192 Change-Id: Ib31205207def253dc89802898a899b3555ecc28d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153953 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
Fixes #32192 This has been illegal for some time. This change updates the analyzer to match the behavior of CFE. Also move the relevant tests to diagnostics/ Change-Id: I4539aeb65708e2594c52288a6b4584ba7e5455e4 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153066 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
Consider the following code
Alanyzer in nostrong mode produces warning
warning - Functions marked 'sync*' must have a return type assignable to 'Iterable'
I'm expecting an error in a strong mode but there is, surprisingly, no issues!
The same is true for async* functions
warning - Functions marked 'async*' must have a return type assignable to 'Stream'
in a nostrong mode and no issues in a strong one
Tested on dartanalyzer version 2.0.0-dev.26.0 on Windows
The text was updated successfully, but these errors were encountered: