Files
sdk/pkg/front_end/testcases/patterns/object_pattern_errors.dart
T
Chloe Stefantsova 628dd02bc8 [cfe] Support typedefs in object patterns
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I0d29a875a6a0d3bac5c20309a1b4a6c8b48618f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/277960
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-01-02 12:26:52 +00:00

15 lines
440 B
Dart

// Copyright (c) 2022, 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.
class A {}
typedef B<X> = A;
test(dynamic x) {
if (x case A<int>()) {} // Error.
if (x case B()) {} // Ok: the type argument is inferred.
if (x case B<int>()) {} // Ok.
if (x case B<String, num>()) {} // Error.
}