Files
sdk/pkg/front_end/testcases/patterns/object_pattern_errors.dart.strong.expect
T
Johnni Winther 0489b7f5f8 [cfe] Report missing name on object pattern field
Change-Id: I8a1ad9dfe36fb55c9ad8cf9a5d8e92754a38bce6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280177
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-02-02 13:59:03 +00:00

58 lines
1.8 KiB
Plaintext

library /*isNonNullableByDefault*/;
//
// Problems in library:
//
// pkg/front_end/testcases/patterns/object_pattern_errors.dart:12:14: Error: Expected 0 type arguments.
// if (x case A<int>()) {} // Error.
// ^
//
// pkg/front_end/testcases/patterns/object_pattern_errors.dart:15:14: Error: Expected 1 type arguments.
// if (x case B<String, num>()) {} // Error.
// ^
//
// pkg/front_end/testcases/patterns/object_pattern_errors.dart:16:16: Error: The getter name is not specified explicitly, and the pattern is not a variable. Try specifying the getter name explicitly, or using a variable pattern.
// if (x case A(: 5)) {} // Error
// ^
//
// pkg/front_end/testcases/patterns/object_pattern_errors.dart:17:16: Error: A pattern field in an object pattern must be named.
// Try adding a pattern name or ':' before the pattern.
// if (x case A(5)) {} // Error
// ^
//
// pkg/front_end/testcases/patterns/object_pattern_errors.dart:18:20: Error: A pattern field in an object pattern must be named.
// Try adding a pattern name or ':' before the pattern.
// if (x case A(var a)) {} // Error
// ^
//
import self as self;
import "dart:core" as core;
typedef B<unrelated X extends core::Object? = dynamic> = self::A;
class A extends core::Object {
field core::int? field = null;
synthetic constructor •() → self::A
: super core::Object::•()
;
}
static method test(dynamic x) → dynamic {
{
final dynamic #0#0 = x;
if(#0#0 is{ForNonNullableByDefault} invalid-type) {
}
}
if(true) {
}
if(true) {
}
if(true) {
}
if(true) {
}
if(true) {
}
if(true) {
}
}
static method _#B#new#tearOff<unrelated X extends core::Object? = dynamic>() → self::A
return new self::A::•();