-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
3 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 [email protected] | ||
enum E1 {} | ||
// ^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
|
||
enum E {} | ||
// ^ | ||
enum E2 { | ||
// ^^ | ||
// [analyzer] unspecified | ||
// [cfe] unspecified | ||
; | ||
} | ||
|
||
main() { | ||
E e; | ||
print(E1); | ||
print(E2); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,7 @@ | |
/// @description Checks that it is a syntax error if an enum augmentation | ||
/// contains no any values. | ||
/// @author [email protected] | ||
/// @issue 56883 | ||
// SharedOptions=--enable-experiment=macros | ||
|
||
|
42 changes: 42 additions & 0 deletions
42
LanguageFeatures/Augmentation-libraries/augmenting_enum_values_A03_t05.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 [email protected] | ||
/// @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); | ||
} |