Skip to content

Commit

Permalink
#2559. Add augmenting enum values test. (#2921)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgrekhov authored Oct 4, 2024
1 parent 3af31b3 commit 582818c
Showing 1 changed file with 38 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// 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 no any values.
/// @author [email protected]
// SharedOptions=--enable-experiment=macros

enum E1 {
e0;
}

augment enum E1 {}
// ^^
// [analyzer] unspecified
// [cfe] unspecified

enum E2 {
e0;
}

augment enum E2 {
void foo() {}
//^^^^
// [analyzer] unspecified
// [cfe] unspecified
}

main() {
print(E1);
print(E2);
}

0 comments on commit 582818c

Please sign in to comment.