| Index: pkg/analyzer/test/generated/static_type_warning_code_test.dart
|
| diff --git a/pkg/analyzer/test/generated/static_type_warning_code_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
|
| index 64bebe384b455e8853998314a9da960eb49cf339..4568fe9a1c8bc2651e920e8cc2c8f5de1f8f40d9 100644
|
| --- a/pkg/analyzer/test/generated/static_type_warning_code_test.dart
|
| +++ b/pkg/analyzer/test/generated/static_type_warning_code_test.dart
|
| @@ -470,26 +470,26 @@ f() {
|
| ''');
|
| }
|
|
|
| - void test_illegal_return_type_async_function() {
|
| + void test_illegalAsyncGeneratorReturnType_function_nonStream() {
|
| assertErrorsInCode(
|
| '''
|
| -int f() async {}
|
| +int f() async* {}
|
| ''',
|
| - [
|
| - StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE,
|
| - HintCode.MISSING_RETURN
|
| - ]);
|
| + [StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE]);
|
| }
|
|
|
| - void test_illegal_return_type_async_generator_function() {
|
| + void test_illegalAsyncGeneratorReturnType_function_subtypeOfStream() {
|
| + resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
|
| assertErrorsInCode(
|
| '''
|
| -int f() async* {}
|
| +import 'dart:async';
|
| +abstract class SubStream<T> implements Stream<T> {}
|
| +SubStream<int> f() async* {}
|
| ''',
|
| [StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE]);
|
| }
|
|
|
| - void test_illegal_return_type_async_generator_method() {
|
| + void test_illegalAsyncGeneratorReturnType_method_nonStream() {
|
| assertErrorsInCode(
|
| '''
|
| class C {
|
| @@ -499,11 +499,48 @@ class C {
|
| [StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE]);
|
| }
|
|
|
| - void test_illegal_return_type_async_method() {
|
| + void test_illegalAsyncGeneratorReturnType_method_subtypeOfStream() {
|
| + resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
|
| + assertErrorsInCode(
|
| + '''
|
| +import 'dart:async';
|
| +abstract class SubStream<T> implements Stream<T> {}
|
| +class C {
|
| + SubStream<int> f() async* {}
|
| +}
|
| +''',
|
| + [StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE]);
|
| + }
|
| +
|
| + void test_illegalAsyncReturnType_function_nonFuture() {
|
| + assertErrorsInCode(
|
| + '''
|
| +int f() async {}
|
| +''',
|
| + [
|
| + StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE,
|
| + HintCode.MISSING_RETURN
|
| + ]);
|
| + }
|
| +
|
| + void test_illegalAsyncReturnType_function_subtypeOfFuture() {
|
| + resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
|
| + assertErrorsInCode(
|
| + '''
|
| +import 'dart:async';
|
| +abstract class SubFuture<T> implements Future<T> {}
|
| +SubFuture<int> f() async {
|
| + return 0;
|
| +}
|
| +''',
|
| + [StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE]);
|
| + }
|
| +
|
| + void test_illegalAsyncReturnType_method_nonFuture() {
|
| assertErrorsInCode(
|
| '''
|
| class C {
|
| - int f() async {}
|
| + int m() async {}
|
| }
|
| ''',
|
| [
|
| @@ -512,7 +549,22 @@ class C {
|
| ]);
|
| }
|
|
|
| - void test_illegal_return_type_sync_generator_function() {
|
| + void test_illegalAsyncReturnType_method_subtypeOfFuture() {
|
| + resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
|
| + assertErrorsInCode(
|
| + '''
|
| +import 'dart:async';
|
| +abstract class SubFuture<T> implements Future<T> {}
|
| +class C {
|
| + SubFuture<int> m() async {
|
| + return 0;
|
| + }
|
| +}
|
| +''',
|
| + [StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE]);
|
| + }
|
| +
|
| + void test_illegalSyncGeneratorReturnType_function_nonIterator() {
|
| assertErrorsInCode(
|
| '''
|
| int f() sync* {}
|
| @@ -520,7 +572,17 @@ int f() sync* {}
|
| [StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE]);
|
| }
|
|
|
| - void test_illegal_return_type_sync_generator_method() {
|
| + void test_illegalSyncGeneratorReturnType_function_subclassOfIterator() {
|
| + resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
|
| + assertErrorsInCode(
|
| + '''
|
| +abstract class SubIterator<T> implements Iterator<T> {}
|
| +SubIterator<int> f() sync* {}
|
| +''',
|
| + [StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE]);
|
| + }
|
| +
|
| + void test_illegalSyncGeneratorReturnType_method_nonIterator() {
|
| assertErrorsInCode(
|
| '''
|
| class C {
|
| @@ -530,6 +592,18 @@ class C {
|
| [StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE]);
|
| }
|
|
|
| + void test_illegalSyncGeneratorReturnType_method_subclassOfIterator() {
|
| + resetWithOptions(new AnalysisOptionsImpl()..strongMode = true);
|
| + assertErrorsInCode(
|
| + '''
|
| +abstract class SubIterator<T> implements Iterator<T> {}
|
| +class C {
|
| + SubIterator<int> f() sync* {}
|
| +}
|
| +''',
|
| + [StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE]);
|
| + }
|
| +
|
| void test_inconsistentMethodInheritance_paramCount() {
|
| assertErrorsInCode(
|
| r'''
|
|
|