[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:
Chloe Stefantsova 2022-09-21 08:05:47 +00:00 committed by Commit Bot
parent fba97eb77f
commit 9f75d4426e
2 changed files with 17 additions and 6 deletions

View 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.
}

View file

@ -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);
}