mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:16:51 +00:00
Update some test expectations with fixed CFE errors
Change-Id: I69f09a4f854b6c84dfaff82abbf0214565bf6aa6 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/293881 Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Bob Nystrom <rnystrom@google.com>
This commit is contained in:
parent
7ba94c9202
commit
1694bb85c8
|
@ -10,8 +10,7 @@ main() {
|
|||
case bool x when x = true:
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.PATTERN_VARIABLE_ASSIGNMENT_INSIDE_GUARD
|
||||
// ^
|
||||
// [cfe] unspecified
|
||||
// [cfe] Pattern variables can't be assigned inside the guard of the enclosing guarded pattern.
|
||||
print(x);
|
||||
default:
|
||||
}
|
||||
|
@ -20,16 +19,14 @@ main() {
|
|||
bool x when x = true => x,
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.PATTERN_VARIABLE_ASSIGNMENT_INSIDE_GUARD
|
||||
// ^
|
||||
// [cfe] unspecified
|
||||
// [cfe] Pattern variables can't be assigned inside the guard of the enclosing guarded pattern.
|
||||
_ => false
|
||||
});
|
||||
|
||||
if (false case bool x when x = true) {
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.PATTERN_VARIABLE_ASSIGNMENT_INSIDE_GUARD
|
||||
// ^
|
||||
// [cfe] unspecified
|
||||
// [cfe] Pattern variables can't be assigned inside the guard of the enclosing guarded pattern.
|
||||
print(x);
|
||||
}
|
||||
|
||||
|
@ -37,8 +34,7 @@ main() {
|
|||
if (false case bool x when x = true)
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.PATTERN_VARIABLE_ASSIGNMENT_INSIDE_GUARD
|
||||
// ^
|
||||
// [cfe] unspecified
|
||||
// [cfe] Pattern variables can't be assigned inside the guard of the enclosing guarded pattern.
|
||||
x
|
||||
]);
|
||||
|
||||
|
@ -49,9 +45,8 @@ main() {
|
|||
return x = true;
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.PATTERN_VARIABLE_ASSIGNMENT_INSIDE_GUARD
|
||||
// [cfe] Pattern variables can't be assigned inside the guard of the enclosing guarded pattern.
|
||||
}():
|
||||
// ^
|
||||
// [cfe] unspecified
|
||||
print(x);
|
||||
default:
|
||||
}
|
||||
|
@ -62,10 +57,9 @@ main() {
|
|||
return x = true;
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.PATTERN_VARIABLE_ASSIGNMENT_INSIDE_GUARD
|
||||
// [cfe] Pattern variables can't be assigned inside the guard of the enclosing guarded pattern.
|
||||
})() =>
|
||||
x,
|
||||
// ^
|
||||
// [cfe] unspecified
|
||||
_ => false
|
||||
});
|
||||
|
||||
|
@ -74,9 +68,8 @@ main() {
|
|||
return x = true;
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.PATTERN_VARIABLE_ASSIGNMENT_INSIDE_GUARD
|
||||
// [cfe] Pattern variables can't be assigned inside the guard of the enclosing guarded pattern.
|
||||
})()) {
|
||||
// ^
|
||||
// [cfe] unspecified
|
||||
print(x);
|
||||
}
|
||||
|
||||
|
@ -86,9 +79,8 @@ main() {
|
|||
return x = true;
|
||||
// ^
|
||||
// [analyzer] COMPILE_TIME_ERROR.PATTERN_VARIABLE_ASSIGNMENT_INSIDE_GUARD
|
||||
// [cfe] Pattern variables can't be assigned inside the guard of the enclosing guarded pattern.
|
||||
})())
|
||||
// ^
|
||||
// [cfe] unspecified
|
||||
x
|
||||
]);
|
||||
|
||||
|
|
|
@ -13,8 +13,8 @@ main() {
|
|||
case (1, final int x):
|
||||
print(x);
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_PATTERN_VARIABLE_IN_SHARED_CASE_SCOPE
|
||||
// [cfe] Variable pattern 'x' doesn't have the same type or finality in all cases.
|
||||
}
|
||||
|
||||
switch ((0, 1)) {
|
||||
|
@ -22,29 +22,27 @@ main() {
|
|||
case (3, final x):
|
||||
print(x);
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_PATTERN_VARIABLE_IN_SHARED_CASE_SCOPE
|
||||
// [cfe] Variable pattern 'x' doesn't have the same type or finality in all cases.
|
||||
}
|
||||
|
||||
// Variables in shared cases must agree on type if used in the body.
|
||||
switch ((0, 1)) {
|
||||
case (0, int x):
|
||||
// ^
|
||||
// [cfe] unspecified
|
||||
case (1, num x):
|
||||
print(x);
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_PATTERN_VARIABLE_IN_SHARED_CASE_SCOPE
|
||||
// [cfe] Variable pattern 'x' doesn't have the same type or finality in all cases.
|
||||
}
|
||||
|
||||
switch ((0, 's')) {
|
||||
case (0, int x):
|
||||
// ^
|
||||
// [cfe] unspecified
|
||||
case (2, var x): // Infer String.
|
||||
print(x);
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_PATTERN_VARIABLE_IN_SHARED_CASE_SCOPE
|
||||
// [cfe] Variable pattern 'x' doesn't have the same type or finality in all cases.
|
||||
}
|
||||
|
||||
// Variables must be defined in all cases if used in body.
|
||||
|
@ -54,13 +52,13 @@ main() {
|
|||
case (2, var inTwo):
|
||||
print(unique);
|
||||
// ^^^^^^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_PATTERN_VARIABLE_IN_SHARED_CASE_SCOPE
|
||||
// [cfe] The variable 'unique' is available in some, but not all cases that share this body.
|
||||
|
||||
print(inTwo);
|
||||
// ^^^^^
|
||||
// [analyzer] unspecified
|
||||
// [cfe] unspecified
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_PATTERN_VARIABLE_IN_SHARED_CASE_SCOPE
|
||||
// [cfe] The variable 'inTwo' is available in some, but not all cases that share this body.
|
||||
}
|
||||
|
||||
// Mismatched variable types because of inference from a promoted type.
|
||||
|
@ -69,12 +67,11 @@ main() {
|
|||
if (value is int) {
|
||||
switch ((0, value)) {
|
||||
case (0, var a):
|
||||
// ^
|
||||
// [cfe] unspecified
|
||||
case (1, Object a):
|
||||
print(a);
|
||||
// ^
|
||||
// [analyzer] unspecified
|
||||
// [analyzer] COMPILE_TIME_ERROR.INVALID_PATTERN_VARIABLE_IN_SHARED_CASE_SCOPE
|
||||
// [cfe] Variable pattern 'a' doesn't have the same type or finality in all cases.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue