Skip to content

Commit 55b4a24

Browse files
joshualittcommit-bot@chromium.org
authored andcommitted
[dart2js] Fix type promotion bug in static_type.dart.
Change-Id: I481020289df611ed09fe4093021e875e6c4f6871 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138333 Commit-Queue: Joshua Litt <[email protected]> Reviewed-by: Mayank Patke <[email protected]>
1 parent a1992fe commit 55b4a24

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

pkg/compiler/lib/src/ir/static_type.dart

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1013,8 +1013,11 @@ abstract class StaticTypeVisitor extends StaticTypeBase {
10131013

10141014
@override
10151015
ir.DartType visitExpressionStatement(ir.ExpressionStatement node) {
1016-
visitNode(node.expression);
1017-
return null;
1016+
if (completes(visitNode(node.expression))) {
1017+
return null;
1018+
} else {
1019+
return const DoesNotCompleteType();
1020+
}
10181021
}
10191022

10201023
void handleAsExpression(ir.AsExpression node, ir.DartType operandType) {}

tests/compiler/dart2js/analyses/api_allowed.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
"org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/js_helper.dart": {
1010
"Dynamic invocation of '[]'.": 3,
1111
"Dynamic access of 'isNaN'.": 3,
12-
"Dynamic invocation of '<='.": 4,
13-
"Dynamic invocation of '-'.": 4,
14-
"Dynamic invocation of '>>'.": 2,
15-
"Dynamic invocation of '&'.": 3,
16-
"Dynamic invocation of '<'.": 3,
17-
"Dynamic invocation of '>'.": 2,
12+
"Dynamic invocation of '<='.": 2,
13+
"Dynamic invocation of '-'.": 3,
14+
"Dynamic invocation of '&'.": 1,
15+
"Dynamic invocation of '>>'.": 1,
16+
"Dynamic invocation of '<'.": 2,
1817
"Dynamic invocation of '+'.": 1,
18+
"Dynamic invocation of '>'.": 1,
1919
"Dynamic access of 'length'.": 1
2020
},
2121
"org-dartlang-sdk:///sdk/lib/_internal/js_runtime/lib/string_helper.dart": {
2222
"Dynamic invocation of '<'.": 1,
2323
"Dynamic invocation of '+'.": 1,
2424
"Dynamic invocation of '>='.": 1,
2525
"Dynamic invocation of 'substring'.": 7,
26-
"Dynamic invocation of 'allMatches'.": 4,
26+
"Dynamic invocation of 'allMatches'.": 3,
2727
"Dynamic access of 'isNotEmpty'.": 1,
2828
"Dynamic invocation of '_js_helper::_execGlobal'.": 1,
2929
"Dynamic access of 'start'.": 1,

0 commit comments

Comments
 (0)