-
Notifications
You must be signed in to change notification settings - Fork 1.7k
NNBD: Analyzer throws a compile error when async function returns dynamic #41266
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
Right, something happened to the checks in the analyzer for a returned expression of type
One more thing happened in 2.8, because it now claims that the return type is |
There is a clear issue with the wording of the error message here: The return type of With respect to the treatment of returned expressions of type |
@eernstg @leafpetersen it sounds like the discussions taking place there are about the possibility of changing the specified return rules. Can you clarify whether @iarkh's code snippet above ought to produce a compile time error under the current rules? As I understand it, currently the analyzer produces an error, and the co19 tests expect no error, so we are seeing co19 failures. It would be nice if in the short term (while we wait for a decision on dart-lang/language#914), we could change either the analyzer implementation or the co19 tests to match the current spec. But it's not clear to me from the discussion here which is correct under the current spec rules. Thanks! |
The analyzer behavior is correct. Section 9 of the spec says that it is a compile time error if:
and the relevant passage of section 17.12 is:
here If any changes are forthcoming in the spec we will open issues for implementation when needed. |
Dart VM version: 2.8.0-dev.18.0 (dev) (Fri Mar 27 11:10:52 2020 +0100) on "windows_x64"
The following sample code example fails with analyzer on the line 3 and passes with dart:
Seems like there should not be compile error here.
Please note that analyzer is OK with the lines 4 and 5.
Sample output is:
The text was updated successfully, but these errors were encountered: