File tree 1 file changed +33
-0
lines changed
LanguageFeatures/Enhanced-Enum 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change
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
+
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
+ }
You can’t perform that action at this time.
0 commit comments