-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[parser] Add missing handling of null-aware elements in if-else
Part of #55954 Change-Id: Ie22ff9ddf50f47e20b1cfbf11f01bdc900123619 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/388003 Reviewed-by: Johnni Winther <[email protected]> Commit-Queue: Chloe Stefantsova <[email protected]>
- Loading branch information
1 parent
3b8eca8
commit 06223ff
Showing
6 changed files
with
4,175 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
pkg/front_end/parser_testcases/null_aware_elements/nested.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
test1(List list, bool Function(dynamic) p, int? a) { | ||
return { | ||
for (var element in list) | ||
if (p(element)) | ||
?a | ||
}; | ||
} | ||
|
||
test2(List list, bool Function(dynamic) p, int? a, int? b) { | ||
return { | ||
for (var element in list) | ||
if (p(element)) | ||
?a | ||
else | ||
?b | ||
}; | ||
} | ||
|
||
test3(List list, bool t, int? a) { | ||
return { | ||
if (t) | ||
for (var element in list) | ||
?a | ||
}; | ||
} | ||
|
||
test4(List list, bool t, int? a, int? b) { | ||
return { | ||
if (t) | ||
for (var element in list) | ||
?a | ||
else | ||
for (var element in list) | ||
?b | ||
}; | ||
} | ||
|
||
test5(List list, bool Function(dynamic) p, int? a) { | ||
return { | ||
for (var element in list) | ||
if (p(element)) | ||
?a: "value" | ||
}; | ||
} | ||
|
||
test6(List list, bool Function(dynamic) p, int? a, int? b) { | ||
return { | ||
for (var element in list) | ||
if (p(element)) | ||
?a: "value" | ||
else | ||
?b: "value" | ||
}; | ||
} | ||
|
||
test7(List list, bool t, int? a) { | ||
return { | ||
if (t) | ||
for (var element in list) | ||
?a: "value" | ||
}; | ||
} | ||
|
||
test8(List list, bool t, int? a, int? b) { | ||
return { | ||
if (t) | ||
for (var element in list) | ||
?a: "value" | ||
else | ||
for (var element in list) | ||
?b: "value" | ||
}; | ||
} | ||
|
||
test9(List list, bool Function(dynamic) p, int? a) { | ||
return { | ||
for (var element in list) | ||
if (p(element)) | ||
"key": ?a | ||
}; | ||
} | ||
|
||
test10(List list, bool Function(dynamic) p, int? a, int? b) { | ||
return { | ||
for (var element in list) | ||
if (p(element)) | ||
"key": ?a | ||
else | ||
"key": ?b | ||
}; | ||
} | ||
|
||
test11(List list, bool t, int? a) { | ||
return { | ||
if (t) | ||
for (var element in list) | ||
"key": ?a | ||
}; | ||
} | ||
|
||
test12(List list, bool t, int? a, int? b) { | ||
return { | ||
if (t) | ||
for (var element in list) | ||
"key": ?a | ||
else | ||
for (var element in list) | ||
"key": ?b | ||
}; | ||
} |
Oops, something went wrong.