68c326f455
This enables caching during matching. Closes https://github.com/dart-lang/sdk/issues/50934 Closes https://github.com/dart-lang/sdk/issues/50987 Change-Id: Iae1d8e0989029a193ba77f58338890d9bfa0c09f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279384 Reviewed-by: Chloe Stefantsova <cstefantsova@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
27 lines
540 B
Dart
27 lines
540 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.
|
|
|
|
test(o) {
|
|
switch (o) {
|
|
case int a:
|
|
return 1;
|
|
}
|
|
switch (o) {
|
|
case String a:
|
|
return 2;
|
|
}
|
|
return 0;
|
|
}
|
|
|
|
main() {
|
|
expect(1, test(0));
|
|
expect(2, test('foo'));
|
|
expect(0, test(true));
|
|
}
|
|
|
|
expect(expected, actual) {
|
|
if (expected != actual) {
|
|
throw 'Expected $expected, actual $actual';
|
|
}
|
|
} |