dart-sdk/tests/language/record_literal_problems_test.dart
Jens Johansen cec94a1446 [parser] Empty record types, record types with 1 element
This should bring parsing of record types up-to-date with v1.6 of
https://github.com/dart-lang/language/blob/master/working/0546-patterns/records-feature-specification.md

Also fixes https://github.com/dart-lang/sdk/issues/49826

Change-Id: I3737a72ddee49a957bd55f86cc200fb77f23e2a0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/256660
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-08-30 11:04:10 +00:00

18 lines
604 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.
// SharedOptions=--enable-experiment=records
main() {
var r1 = const (42);
// ^
// [analyzer] SYNTACTIC_ERROR.RECORD_LITERAL_ONE_POSITIONAL_NO_TRAILING_COMMA
// [cfe] Record literal with one field requires a trailing comma.
var r2 = const ();
// ^
// [analyzer] SYNTACTIC_ERROR.RECORD_LITERAL_EMPTY
// [cfe] Record literal can't be empty.
}