Skip to content

Analyzer throws a compile error when async function with Future<bool> return type returns dynamic. #42237

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

Closed
iarkh opened this issue Jun 9, 2020 · 1 comment
Assignees
Labels
legacy-area-analyzer Use area-devexp instead. NNBD Issues related to NNBD Release type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@iarkh
Copy link
Contributor

iarkh commented Jun 9, 2020

Dart VM version: 2.9.0-13.0.dev (dev) (Fri May 29 15:59:05 2020 +0200) on "windows_x64"

This issue is related with SDK Issues #41266, #41437, as well as with co19 issues #603 and 703.

It is similar with #42236, but it's agains analyzer, not dart.

Seems like after the #941 the following code should not throw compile error:

import "dart:async";
dynamic getNull() => null;
Future<bool> test1() async => await getNull();
main() {}

However, still dartanalyzer behaves in such a way.

Sample output is:

$> dartanalyzer --enable-experiment=non-nullable test.dart
Analyzing test.dart...
error - A value of type 'dynamic' can't be returned from function 'test1' because it has a return type of 'Future'. - test.dart:3:31 - return_of_invalid_type
1 error found.

@lrhn lrhn added legacy-area-analyzer Use area-devexp instead. NNBD Issues related to NNBD Release type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jun 9, 2020
@scheglov scheglov self-assigned this Jun 16, 2020
@scheglov
Copy link
Contributor

This was fixed in 89782c9, the same day as the SDK build that you are trying.
But maybe a few hours later?

Works for me with the bleeding edge SDK.
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
legacy-area-analyzer Use area-devexp instead. NNBD Issues related to NNBD Release type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants