diff --git a/Language/Enums/syntax_t02.dart b/Language/Enums/syntax_t02.dart index 139ef4547a..d51ea4b8d9 100644 --- a/Language/Enums/syntax_t02.dart +++ b/Language/Enums/syntax_t02.dart @@ -7,16 +7,24 @@ /// enumType: /// metadata enum id ‘{’ id [‘, ’ id]* [‘, ’] ‘}’ /// ; +/// /// @description Checks that it is compile-time error if enum does not declare -/// any member +/// any member. /// @author sgrekhov@unipro.ru +enum E1 {} +// ^^ +// [analyzer] unspecified +// [cfe] unspecified -enum E {} -// ^ +enum E2 { +// ^^ // [analyzer] unspecified // [cfe] unspecified + ; +} main() { - E e; + print(E1); + print(E2); } diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_enum_values_A03_t04.dart b/LanguageFeatures/Augmentation-libraries/augmenting_enum_values_A03_t04.dart index 216d9f196d..3059318780 100644 --- a/LanguageFeatures/Augmentation-libraries/augmenting_enum_values_A03_t04.dart +++ b/LanguageFeatures/Augmentation-libraries/augmenting_enum_values_A03_t04.dart @@ -9,6 +9,7 @@ /// @description Checks that it is a syntax error if an enum augmentation /// contains no any values. /// @author sgrekhov22@gmail.com +/// @issue 56883 // SharedOptions=--enable-experiment=macros diff --git a/LanguageFeatures/Augmentation-libraries/augmenting_enum_values_A03_t05.dart b/LanguageFeatures/Augmentation-libraries/augmenting_enum_values_A03_t05.dart new file mode 100644 index 0000000000..c5b422b8a9 --- /dev/null +++ b/LanguageFeatures/Augmentation-libraries/augmenting_enum_values_A03_t05.dart @@ -0,0 +1,42 @@ +// Copyright (c) 2024, 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. + +/// @assertion New enum values may be defined in an augmenting enum, and they +/// will be appended to the current values of the declaration in augmentation +/// application order. +/// +/// @description Checks that it is a syntax error if an enum augmentation +/// contains an empty list of values. +/// @author sgrekhov22@gmail.com +/// @issue 56883 + +// SharedOptions=--enable-experiment=macros + +enum E1 { + e0; +} + +augment enum E1 { + ; +//^ +// [analyzer] unspecified +// [cfe] unspecified +} + +enum E2 { + e0; +} + +augment enum E2 { + ; +//^ +// [analyzer] unspecified +// [cfe] unspecified + void foo() {} +} + +main() { + print(E1); + print(E2); +}