Skip to content

Commit 058e258

Browse files
scheglovcommit-bot@chromium.org
authored andcommitted
Issue 42093. Add async test.
[email protected] Bug: #42093 Change-Id: I96b5c1597d7d16b269b6f6c7d3fd67bd960ff589 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149604 Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]>
1 parent dd6dc29 commit 058e258

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

pkg/analyzer/test/src/diagnostics/return_of_invalid_type_test.dart

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -361,13 +361,17 @@ Future<void> f() async {
361361
]);
362362
}
363363

364-
test_function_async_expression_dynamic__to_Future_int() async {
365-
await assertNoErrorsInCode(r'''
366-
Future<int> f(dynamic a) async => a;
367-
''');
364+
test_function_async_block_void__to_Future_Null() async {
365+
await assertErrorsInCode(r'''
366+
Future<Null> f(void a) async {
367+
return a;
368+
}
369+
''', [
370+
error(StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_FUNCTION, 40, 1),
371+
]);
368372
}
369373

370-
test_function_async_void__to_FutureOr_ObjectQ() async {
374+
test_function_async_block_void__to_FutureOr_ObjectQ() async {
371375
await assertErrorsInCode(r'''
372376
import 'dart:async';
373377
@@ -379,6 +383,12 @@ FutureOr<Object?> f(void a) async {
379383
]);
380384
}
381385

386+
test_function_async_expression_dynamic__to_Future_int() async {
387+
await assertNoErrorsInCode(r'''
388+
Future<int> f(dynamic a) async => a;
389+
''');
390+
}
391+
382392
test_functionExpression_async_futureOr_void__to_Object() async {
383393
await assertNoErrorsInCode(r'''
384394
void a = null;

0 commit comments

Comments
 (0)