-
Notifications
You must be signed in to change notification settings - Fork 1.7k
NNBD: Future flattening for Future<Never>works in different ways with dart and analyzer #41324
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 believe this is not fully specified. I also believe that we should be able to decide that line 7 is an error, cf. dart-lang/language#913 (looking at the example, I consider this one to be line 7: Lines 5 and 6 are currently already an error according to the language specification rules about return statements (here), but that's an anomaly (it happens because |
Marked this issue as blocked, because we need to settle dart-lang/language#913, and possibly dart-lang/language#914. |
I believe that the first two tests, as currently specified, are compile time errors, and the third test, as currently specified, is an implicit downcast and hence a runtime error. I don't see any reason to change any of these, I think the CFE is just missing some errors here. |
Agreed, 'as currently specified', I've added a concrete example in #914, along with some discussion illustrating why it is an anomaly and an accident that this error arises . |
@eernstg the blocking issues you mention are closed. I believe this is unblocked? |
Yes, thanks! dart-lang/language#914 gave rise to changes in the static analysis of returns in A fresh front end, b2e33ee, still does not report any errors for the example here, and a fresh analyzer does not report any errors. So it's working as specified and tools are consistent. Closing. |
Dart VM version: 2.8.0-dev.20.0 (dev) (Fri Apr 3 10:19:55 2020 +0200) on "windows_x64"
Analyzer throws compile error on the lines 5 and 6 with the following source code:
Please not that there is no exception for the line 7 here.
Dart does not throw compile error, runtime exception appears here instead.
I am not sure which behavior is correct, but definitely dart and analyzer should run in the same way here.
Sample output is:
The text was updated successfully, but these errors were encountered: