Skip to content

Commit 7837d31

Browse files
committed
1 parent c2e65df commit 7837d31

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

pkg/dev_compiler/lib/src/checker/checker.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -670,6 +670,12 @@ class CodeChecker extends RecursiveAstVisitor {
670670
node.visitChildren(this);
671671
}
672672

673+
@override
674+
void visitAwaitExpression(AwaitExpression node) {
675+
checkAssignment(node.expression, _rules.provider.futureDynamicType);
676+
node.visitChildren(this);
677+
}
678+
673679
@override
674680
void visitPropertyAccess(PropertyAccess node) {
675681
var target = node.realTarget;

pkg/dev_compiler/test/checker/checker_test.dart

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2686,6 +2686,16 @@ void main() {
26862686
Future bar2() async { return x; }
26872687
Future<int> bar3() async { return (/*info:DynamicCast*/x); }
26882688
Future<int> bar4() async { return (/*severe:StaticTypeError*/new Future<int>(x)); }
2689+
2690+
int y;
2691+
Future<int> z;
2692+
2693+
void baz() async {
2694+
int a = /*info:DynamicCast*/await /*info:DynamicCast*/x;
2695+
int b = await /*severe:StaticTypeError*/y;
2696+
int c = await z;
2697+
String d = /*severe:StaticTypeError*/await z;
2698+
}
26892699
'''
26902700
}));
26912701

0 commit comments

Comments
 (0)