Version 2.15.0-279.0.dev
Merge commit '8cc7d0b11518ab3b209a0866eef0733efdc4f256' into 'dev'
diff --git a/pkg/analyzer/lib/src/error/return_type_verifier.dart b/pkg/analyzer/lib/src/error/return_type_verifier.dart
index 06ef0ed..2ae92c7 100644
--- a/pkg/analyzer/lib/src/error/return_type_verifier.dart
+++ b/pkg/analyzer/lib/src/error/return_type_verifier.dart
@@ -134,6 +134,12 @@
return;
}
+ if (enclosingExecutable.isGenerator) {
+ // [CompileTimeErrorCode.RETURN_IN_GENERATOR] has already been reported;
+ // do not report a duplicate error.
+ return;
+ }
+
if (_typeSystem.isNonNullableByDefault) {
_checkReturnExpression_nullSafety(expression);
} else {
diff --git a/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart b/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart
index 89bab3f..ef2237d 100644
--- a/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart
@@ -234,6 +234,15 @@
''');
}
+ test_function_asyncStar() async {
+ await assertErrorsInCode('''
+Stream<int> f() async* => 3;
+''', [
+ // RETURN_OF_INVALID_TYPE shouldn't be reported in addition to this error.
+ error(CompileTimeErrorCode.RETURN_IN_GENERATOR, 23, 2),
+ ]);
+ }
+
test_function_sync_block__to_dynamic() async {
await assertNoErrorsInCode(r'''
f() {
@@ -430,6 +439,15 @@
]);
}
+ test_function_syncStar() async {
+ await assertErrorsInCode('''
+Iterable<int> f() sync* => 3;
+''', [
+ // RETURN_OF_INVALID_TYPE shouldn't be reported in addition to this error.
+ error(CompileTimeErrorCode.RETURN_IN_GENERATOR, 24, 2),
+ ]);
+ }
+
test_getter_sync_block_String__to_int() async {
await assertErrorsInCode('''
int get g {
diff --git a/tools/VERSION b/tools/VERSION
index beb2a85..606d727 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 278
+PRERELEASE 279
PRERELEASE_PATCH 0
\ No newline at end of file