Skip to content

Commit 58a1c34

Browse files
committed
#3057. Update tests to follow assertion text
1 parent 79ecc59 commit 58a1c34

8 files changed

+26
-19
lines changed

TypeSystem/flow-analysis/reachability_A08_t01.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,9 @@
3737

3838
main() {
3939
int i;
40-
Null n = null;
41-
if (n == null) {
40+
Null n1 = null;
41+
Null n2 = null;
42+
if (n1 == n2) {
4243
i = 42; // condition is always true therefore `i` must be definitely assigned
4344
}
4445
i; // It's not an error to read local non-nullable variable if it is definitely assigned

TypeSystem/flow-analysis/reachability_A08_t02.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@
3535
3636
// Requirements=nnbd-strong
3737

38-
Null get n => null;
38+
Null get n1 => null;
3939

4040
main() {
4141
int i;
42-
if (n == null) {
42+
Null n2;
43+
if (n1 == n2) {
4344
i = 42; // condition is always true therefore `i` must be definitely assigned
4445
}
4546
i; // It's not an error to read local non-nullable variable if it is definitely assigned

TypeSystem/flow-analysis/reachability_A08_t03.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
/// `(int? x) => x == (x = null) ? true : x.isEven`, which tries to call
2828
/// `null.isEven` in the event of a non-null input).
2929
///
30-
/// @description Checks reachability after variable or getter. Test non-nullable
31-
/// type.
30+
/// @description Checks that if `equivalentToNull(T2)` and `T1` is non-nullable,
31+
/// then `true(N) = unreachable(after(E2))` and `false(N) = after(E2)`.
3232
/// @author [email protected]
3333
/// @issue 41981
3434
/// @issue 60114

TypeSystem/flow-analysis/reachability_A08_t04.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
/// `(int? x) => x == (x = null) ? true : x.isEven`, which tries to call
2828
/// `null.isEven` in the event of a non-null input).
2929
///
30-
/// @description Checks reachability after variable or getter. Test getter of
31-
/// non-nullable type
30+
/// @description Checks that if `equivalentToNull(T1)` and `T2` is non-nullable,
31+
/// then `true(N) = unreachable(after(E2))` and `false(N) = after(E2)`.
3232
/// @author [email protected]
3333
/// @issue 41981
3434
/// @issue 60114
@@ -39,7 +39,7 @@ String get s => "Lily was here";
3939

4040
main() {
4141
late int i;
42-
if (s == null) { // ignore: unnecessary_null_comparison
42+
if (null == s) { // ignore: unnecessary_null_comparison
4343
i = 42; // `i` is definitely unassigned
4444
}
4545
i;

TypeSystem/flow-analysis/reachability_A09_t01.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66
/// treated as equivalent to the expression `!(E1 == E2)`.
77
///
88
/// @description Checks that an expression of the form `E1 != E2` is treated as
9-
/// equivalent to the expression `!(E1 == E2)`.
9+
/// equivalent to the expression `!(E1 == E2)`. Test `equivalentToNull(T1)` and
10+
/// `equivalentToNull(T2) case.
1011
/// @author [email protected]
1112
/// @issue 41981
1213
1314
main() {
1415
late int i;
15-
Null n = null;
16-
if (n != null) {
16+
Null n1 = null;
17+
Null n2 = null;
18+
if (n1 != n2) {
1719
i = 42; // Variable is initialized in a dead code. This leaves it definitely unassigned
1820
}
1921
i; // It is an error to read a local late variable when it is definitely unassigned.

TypeSystem/flow-analysis/reachability_A09_t02.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66
/// treated as equivalent to the expression `!(E1 == E2)`.
77
///
88
/// @description Checks that an expression of the form `E1 != E2` is treated as
9-
/// equivalent to the expression `!(E1 == E2)`. Test getter of the type `Null`.
9+
/// equivalent to the expression `!(E1 == E2)`. Test `equivalentToNull(T1)` and
10+
/// `equivalentToNull(T2) case and getter of the type `Null`.
1011
/// @author [email protected]
1112
/// @issue 41981
1213
13-
Null get n => null;
14+
Null get n1 => null;
1415

1516
main() {
1617
late int i;
17-
if (n != null) {
18+
Null n2;
19+
if (n1 != n2) {
1820
i = 42; // Variable is initialized in a dead code. This leaves it definitely unassigned
1921
}
2022
i; // It is an error to read a local late variable when it is definitely unassigned.

TypeSystem/flow-analysis/reachability_A09_t03.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
/// treated as equivalent to the expression `!(E1 == E2)`.
77
///
88
/// @description Checks that an expression of the form `E1 != E2` is treated as
9-
/// equivalent to the expression `!(E1 == E2)`. Test a non-nullable type
9+
/// equivalent to the expression `!(E1 == E2)`. Test `equivalentToNull(T2)` and
10+
/// `T1` is non-nullable case.
1011
/// @author [email protected]
1112
/// @issue 41985
1213
/// @issue 60114

TypeSystem/flow-analysis/reachability_A09_t04.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
/// Let null(N) = unreachable(before(N)).
1616
/// Let notNull(N) = before(N).
1717
///
18-
/// @description Checks reachability after variable or getter. Test getter of
19-
/// non-nullable type
18+
/// @description Checks reachability after variable or getter. Test
19+
/// `equivalentToNull(T1)` and `T2` is non-nullable
2020
/// @author [email protected]
2121
/// @issue 41985
2222
/// @issue 60114
@@ -25,7 +25,7 @@ String get s => "Lily was here";
2525

2626
main() {
2727
int i;
28-
if (s != null) { // ignore: unnecessary_null_comparison
28+
if (null != s) { // ignore: unnecessary_null_comparison
2929
i = 42; // `i` is definitely assigned here
3030
}
3131
i; // It is not an error to read a local non-nullable variable which is definitely assigned

0 commit comments

Comments
 (0)