mirror of
https://github.com/dart-lang/sdk
synced 2024-09-05 08:24:39 +00:00
[tests] Split out tests involving Record.empty
This is needed because the Record.empty constant isn't implemented yet, to avoid compile-time errors in tests that don't expect any. Change-Id: Ic7e61fb285a65a5809979e4c32b632f73f9e2d88 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/260107 Reviewed-by: Erik Ernst <eernst@google.com> Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
This commit is contained in:
parent
fba97eb77f
commit
9f75d4426e
17
tests/language/record_type_empty_problems_test.dart
Normal file
17
tests/language/record_type_empty_problems_test.dart
Normal file
|
@ -0,0 +1,17 @@
|
|||
// 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() {
|
||||
(int, int, {/*missing*/}) r1 = (1, 2);
|
||||
// ^
|
||||
// [analyzer] SYNTACTIC_ERROR.EMPTY_RECORD_TYPE_NAMED_FIELDS_LIST
|
||||
// [cfe] Record type named fields list can't be empty.
|
||||
|
||||
(int /* missing trailing comma */ ) r2 = (1, );
|
||||
// ^
|
||||
// [analyzer] SYNTACTIC_ERROR.RECORD_TYPE_ONE_POSITIONAL_NO_TRAILING_COMMA
|
||||
// [cfe] Record type with one entry requires a trailing comma.
|
||||
}
|
|
@ -14,10 +14,4 @@ main() {
|
|||
// ^
|
||||
// [analyzer] SYNTACTIC_ERROR.RECORD_TYPE_ONE_POSITIONAL_NO_TRAILING_COMMA
|
||||
// [cfe] Record type with one entry requires a trailing comma.
|
||||
|
||||
() emptyRecord = Record.empty;
|
||||
// ^^^^^^
|
||||
// [analyzer] COMPILE_TIME_ERROR.UNDEFINED_IDENTIFIER
|
||||
// [cfe] Undefined name 'Record'.
|
||||
print(emptyRecord);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue