Closed
Description
Consider the following library:
Future<bool> f() async => Future<int>.value(42);
dartanalyzer --enable-experiment=non-nullable
from commit d5310cb (of today) responds with the following error message:
ERROR|STATIC_TYPE_WARNING|RETURN_OF_INVALID_TYPE|/usr/local/google/home/eernst/lang/dart/scratch/202004/n039.dart|1|27|21|A value of type 'int' can't be returned from function 'f' because it has a return type of 'bool'.
This error message indicates that the return type of f
is bool
, but it is actually declared as Future<bool>
, so that error message needs to be adjusted. The same behavior exists also without --enable-experiment=non-nullable
.
Discussions about async
returns are ongoing, cf. dart-lang/language#941. However, I do not think that the outcome of that PR will invalidate a fix for this issue.