-
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.
#1258. Added test for a generic enum which does have a regular-bounde…
…d instantiate-to-bounds result
- Loading branch information
sgrekhov
committed
Feb 25, 2022
1 parent
ec3903d
commit 971ac72
Showing
2 changed files
with
30 additions
and
0 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 |
---|---|---|
|
@@ -28,6 +28,7 @@ enum E<Y extends A<Y>> { | |
// [cfe] unspecified | ||
e1<Never>(); | ||
} | ||
|
||
main() { | ||
E.e1; | ||
} |
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,29 @@ | ||
// Copyright (c) 2022, 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 If the resulting class would have any naming conflicts, or other | ||
/// compile-time errors, the enum declaration is invalid and a compile-time | ||
/// error occurs. Such errors include, but are not limited to: | ||
/// ... | ||
/// Declaring a generic enum which does not have a regular-bounded | ||
/// instantiate-to-bounds result and that has an enum value declaration omitting | ||
/// the type arguments and not having arguments from which type arguments can be | ||
/// inferred. (For example enum EnumName<F extends C<F>> { foo; } would | ||
/// introduce an implicit static const foo = EnumName(0, "foo"); declaration | ||
/// where the constructor invocation requires a regular-bounded | ||
/// instantiate-to-bounds result). | ||
/// | ||
/// @description Check that it is no compile-time error to declare a generic | ||
/// enum which does have a regular-bounded instantiate-to-bounds result | ||
/// @author [email protected] | ||
// SharedOptions=--enable-experiment=enhanced-enums | ||
|
||
enum E<Y extends Y Function(Y)> { | ||
e1<Never>(); | ||
} | ||
|
||
main() { | ||
print(E.e1); | ||
} |