Skip to content

Commit

Permalink
More "why not promoted" test cases for for-in loops
Browse files Browse the repository at this point in the history
Bug: #44898
Change-Id: Iea44cd482f21ef4406b28e264046025ce3f87695
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191385
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
  • Loading branch information
stereotype441 authored and commit-bot@chromium.org committed Mar 16, 2021
1 parent 9478b71 commit 217cd49
Showing 1 changed file with 72 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,80 @@ class C1 {
List<int>? bad;
}

test(C1 c) {
forStatement(C1 c) {
if (c.bad == null) return;
for (var x
in /*analyzer.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ c
. /*cfe.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ bad) {}
}

forElementInList(C1 c) {
if (c.bad == null) return;
[
for (var x
in /*analyzer.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ c
. /*cfe.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ bad)
null
];
}

forElementInSet(C1 c) {
if (c.bad == null) return;
<dynamic>{
for (var x
in /*analyzer.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ c
. /*cfe.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ bad)
null
};
}

forElementInMap(C1 c) {
if (c.bad == null) return;
<dynamic, dynamic>{
for (var x
in /*analyzer.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ c
. /*cfe.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ bad)
null,
null
};
}

forElementInAmbiguousSet_resolvableDuringParsing(C1 c) {
if (c.bad == null) return;
({
for (var x
in /*analyzer.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ c
. /*cfe.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ bad)
null
});
}

forElementInAmbiguousMap_resolvableDuringParsing(C1 c) {
if (c.bad == null) return;
({
for (var x
in /*analyzer.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ c
. /*cfe.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ bad)
null: null
});
}

forElementInAmbiguousSet_notResolvableDuringParsing(C1 c, List list) {
if (c.bad == null) return;
({
for (var x
in /*analyzer.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ c
. /*cfe.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ bad)
...list
});
}

forElementInAmbiguousMap_notResolvableDuringParsing(C1 c, Map map) {
if (c.bad == null) return;
({
for (var x
in /*analyzer.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ c
. /*cfe.notPromoted(propertyNotPromoted(target: member:C1.bad, type: List<int>?))*/ bad)
...map
});
}

0 comments on commit 217cd49

Please sign in to comment.