Files
sdk/pkg/front_end/testcases/patterns/issue51587.dart
T
Chloe Stefantsova 2eba00fabb [cfe] Split ensureAssignableResult into coersion and error reporting
It allows to use coersion without error reporting in the inference of
record literals, which makes the difference when the record patterns
are involved.

Closes https://github.com/dart-lang/sdk/issues/51587

Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I64ea7e82eb3bc14d4410a47c6ed6ef278e092496
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290529
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-03-22 17:21:45 +00:00

28 lines
482 B
Dart

// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
test1() {
num b = 0;
b as int;
b.isEven;
(b,) = (3.14,);
return b;
}
test2() {
num b = 0;
b as int;
b.isEven;
(b, foo: _) = (3.14, foo: "foo");
return b;
}
test3() {
num b = 0;
b as int;
b.isEven;
(foo: b) = (foo: 3.14);
return b;
}