Files
sdk/pkg/front_end/testcases/patterns/issue52099.dart
T
Chloe Stefantsova b9b1fdff76 [cfe] Infer type and finality of joint variables in or-patterns
Closes https://github.com/dart-lang/sdk/issues/52099

Change-Id: I019e0a9e38cee35883c197ebae855b0854a0b2ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/297640
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-04-25 06:31:28 +00:00

28 lines
620 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.
typedef SourceLocation = int;
abstract class FieldRef {
int get location;
}
abstract class FuncRef {
int get location;
}
abstract class ClassRef {
int get location;
}
foo(Object object) {
final SourceLocation? sourceLocation = switch (object) {
FieldRef(:final location) ||
FuncRef(:final location) ||
ClassRef(:final location) =>
location,
_ => null,
};
}