Skip to content

Commit d9527f1

Browse files
author
sgrekhov
committed
#1258. Not regular-bounded enum test added
1 parent 1e99290 commit d9527f1

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Copyright (c) 2022, the Dart project authors. Please see the AUTHORS file
2+
// for details. All rights reserved. Use of this source code is governed by a
3+
// BSD-style license that can be found in the LICENSE file.
4+
5+
/// @assertion If the resulting class would have any naming conflicts, or other
6+
/// compile-time errors, the enum declaration is invalid and a compile-time
7+
/// error occurs. Such errors include, but are not limited to:
8+
/// ...
9+
/// Declaring a generic enum which does not have a regular-bounded
10+
/// instantiate-to-bounds result and that has an enum value declaration omitting
11+
/// the type arguments and not having arguments from which type arguments can be
12+
/// inferred. (For example enum EnumName<F extends C<F>> { foo; } would
13+
/// introduce an implicit static const foo = EnumName(0, "foo"); declaration
14+
/// where the constructor invocation requires a regular-bounded
15+
/// instantiate-to-bounds result).
16+
///
17+
/// @description Check that it is a compile-time error to declare a generic enum
18+
/// which does not have a regular-bounded instantiate-to-bounds result
19+
/// @author [email protected]
20+
21+
// SharedOptions=--enable-experiment=enhanced-enums
22+
23+
typedef A<X> = X Function(X);
24+
25+
enum E<Y extends A<Y>> {
26+
// ^
27+
// [analyzer] unspecified
28+
// [cfe] unspecified
29+
e1<Never>();
30+
}
31+
main() {
32+
E.e1;
33+
}

0 commit comments

Comments
 (0)