mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 00:13:50 +00:00
Fix int-to-double test to work on the web.
Change-Id: I5e208edc53543de8d11aa6e81072ad7f61a23d52 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290913 Commit-Queue: Bob Nystrom <rnystrom@google.com> Auto-Submit: Bob Nystrom <rnystrom@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com> Reviewed-by: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
7c6f6d6232
commit
c89ec96b96
|
@ -31,23 +31,25 @@ main() {
|
|||
Expect.fail('Should have matched.');
|
||||
}
|
||||
|
||||
// No coercion on if-case value.
|
||||
if (123 case double d) {
|
||||
// No coercion on if-case value. There should be no context type on the value
|
||||
// from the pattern, and thus `[123]` should be inferred as `<int>[123]`,
|
||||
// which is not matched by `List<double> _`.
|
||||
if ([123] case List<double> _) {
|
||||
Expect.fail('Should not have matched.');
|
||||
} else {
|
||||
// OK.
|
||||
}
|
||||
|
||||
// No coercion on switch statement value.
|
||||
switch (123) {
|
||||
case double d:
|
||||
switch ([123]) {
|
||||
case List<double> _:
|
||||
Expect.fail('Should not have matched.');
|
||||
default:
|
||||
// OK.
|
||||
}
|
||||
|
||||
// No coercion on switch expression value.
|
||||
var result = switch (123) { double d => 'wrong', _ => 'ok' };
|
||||
var result = switch ([123]) { List<double> _ => 'wrong', _ => 'ok' };
|
||||
Expect.equals('ok', result);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue