#1258. More Enhanced Enums semantics tests added
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A10_t01.dart b/LanguageFeatures/Enhanced-Enum/semantics_A10_t01.dart
new file mode 100644
index 0000000..ca3ab6a
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A10_t01.dart
@@ -0,0 +1,55 @@
+// 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 or mixing in a member which is not a valid override of a
+/// super-interface member declaration, including, but not limited to, the index
+/// and toString members of Enum.
+///
+/// @description Check that it is a compile-time error to declare a member which
+/// is not a valid override of a super-interface member declaration
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ String get index => "Lily was here";
+// ^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ String toString(int index) => "E1";
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+ String index() => "Lily was here";
+// ^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ void set toString(int index) {}
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A10_t02.dart b/LanguageFeatures/Enhanced-Enum/semantics_A10_t02.dart
new file mode 100644
index 0000000..ee23872
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A10_t02.dart
@@ -0,0 +1,55 @@
+// 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 or mixing in a member which is not a valid override of a
+/// super-interface member declaration, including, but not limited to, the index
+/// and toString members of Enum.
+///
+/// @description Check that it is a compile-time error to declare a member which
+/// is not a valid override of a super-interface member declaration
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ static int get index => "Lily was here";
+// ^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ static String toString() => "E1";
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+ static String index() => "Lily was here";
+// ^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ static void set toString() {}
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A10_t03.dart b/LanguageFeatures/Enhanced-Enum/semantics_A10_t03.dart
new file mode 100644
index 0000000..bdcb100
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A10_t03.dart
@@ -0,0 +1,59 @@
+// 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 or mixing in a member which is not a valid override of a
+/// super-interface member declaration, including, but not limited to, the index
+/// and toString members of Enum.
+///
+/// @description Check that it is a compile-time error to mixin a member which
+/// is not a valid override of a super-interface member declaration
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+mixin M1 on Enum {
+ String get index => "Lily was here";
+// ^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ int toString() => 42;
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+enum E1 with M1 {
+ e1,
+ e2,
+ e3;
+}
+
+mixin M2 on Enum {
+ int index() => 42;
+// ^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ void set toString(int index) {}
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> with M2 {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A10_t04.dart b/LanguageFeatures/Enhanced-Enum/semantics_A10_t04.dart
new file mode 100644
index 0000000..675c2b1
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A10_t04.dart
@@ -0,0 +1,49 @@
+// 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 or mixing in a member which is not a valid override of a
+/// super-interface member declaration, including, but not limited to, the index
+/// and toString members of Enum.
+///
+/// @description Check that it is a compile-time error to declare a member which
+/// is not a valid override of a super-interface member declaration
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ int operator ==(E1 other) {
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ return 42;
+ }
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+ int operator ==(E2 other) {
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ return 42;
+ }
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A10_t05.dart b/LanguageFeatures/Enhanced-Enum/semantics_A10_t05.dart
new file mode 100644
index 0000000..98bdf85
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A10_t05.dart
@@ -0,0 +1,70 @@
+// 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 or mixing in a member which is not a valid override of a
+/// super-interface member declaration, including, but not limited to, the index
+/// and toString members of Enum.
+///
+/// @description Check that it is no compile-time error to declare a member
+/// which is a valid override of a super-interface member declaration
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+import "../../Utils/expect.dart";
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ int get index => 0;
+ String toString([int index = 0]) => "E1";
+ bool operator ==(covariant E1 other) {
+ return true;
+ }
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+ int get index => 1;
+
+ String toString([int index = 0]) => "E2";
+
+ bool operator ==(covariant E2 other) {
+ return false;
+ }
+}
+
+main() {
+ Expect.equals(0, E1.e1.index);
+ Expect.equals(0, E1.e2.index);
+ Expect.equals(0, E1.e3.index);
+ Expect.equals("E1", E1.e1.toString());
+ Expect.equals("E1", E1.e2.toString(1));
+ Expect.equals("E1", E1.e3.toString());
+ Expect.isTrue(E1.e1 == E1.e2);
+ Expect.isTrue(E1.e1 == E1.e3);
+ Expect.isTrue(E1.e3 == E1.e2);
+ Expect.equals(1, E2.e1.index);
+ Expect.equals(1, E2.e2.index);
+ Expect.equals(1, E2.e3.index);
+ Expect.equals("E2", E2.e1.toString());
+ Expect.equals("E2", E2.e2.toString(1));
+ Expect.equals("E2", E2.e3.toString());
+ Expect.isFalse(E2.e1 == E2.e2);
+ Expect.isFalse(E2.e1 == E2.e3);
+ Expect.isFalse(E2.e3 == E2.e2);
+ Expect.isFalse(E2.e1 == E2.e1);
+ Expect.isFalse(E2.e2 == E2.e2);
+ Expect.isFalse(E2.e3 == E2.e3);
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A11_t01.dart b/LanguageFeatures/Enhanced-Enum/semantics_A11_t01.dart
new file mode 100644
index 0000000..4cb5d5e
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A11_t01.dart
@@ -0,0 +1,55 @@
+// 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 or inheriting a member signature with no corresponding
+/// implementation. (For example declaring an abstract `Never get index` or
+/// `String toString([int optional])`, but not providing an implementation.)
+///
+/// @description Check that it is a compile-time error to declare a member
+/// signature with no corresponding implementation
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ String toString([int index]);
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ void foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+
+ String toString();
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ void foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A11_t02.dart b/LanguageFeatures/Enhanced-Enum/semantics_A11_t02.dart
new file mode 100644
index 0000000..bf2d456
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A11_t02.dart
@@ -0,0 +1,46 @@
+// 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 or inheriting a member signature with no corresponding
+/// implementation. (For example declaring an abstract `Never get index` or
+/// `String toString([int optional])`, but not providing an implementation.)
+///
+/// @description Check that it is a compile-time error to inherit a member
+/// signature with no corresponding implementation
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+abstract class I {
+ String toString([int index]);
+}
+
+enum E1 implements I {
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e1,
+ e2,
+ e3;
+}
+
+enum E2<T> implements I {
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A11_t03.dart b/LanguageFeatures/Enhanced-Enum/semantics_A11_t03.dart
new file mode 100644
index 0000000..05de5c4
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A11_t03.dart
@@ -0,0 +1,46 @@
+// 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 or inheriting a member signature with no corresponding
+/// implementation. (For example declaring an abstract `Never get index` or
+/// `String toString([int optional])`, but not providing an implementation.)
+///
+/// @description Check that it is a compile-time error to inherit a member
+/// signature with no corresponding implementation
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+abstract class I {
+ void foo();
+}
+
+enum E1 implements I {
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e1,
+ e2,
+ e3;
+}
+
+enum E2<T> implements I {
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A12_t01.dart b/LanguageFeatures/Enhanced-Enum/semantics_A12_t01.dart
new file mode 100644
index 0000000..d18e14b
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A12_t01.dart
@@ -0,0 +1,32 @@
+// 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 type parameter on the enum which does not have a valid
+/// well-bounded or super-bounded instantiate-to-bounds result and not declaring
+/// or inheriting a member with base-name values (because the then automatically
+/// introduced static const List<EnumName> values requires a valid
+/// instantiate-to-bounds result which is at least super-bounded, and a value
+/// declaration may require a well-bounded instantiation).
+///
+/// @description Check that it is a compile-time error to declare a type
+/// parameter on the enum which does not have a valid well-bounded result
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E<T extends List> {
+ e1<List<int>>([42]),
+ e2<List<Null>>([null]);
+
+ const E2(T t);
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A13_t01.dart b/LanguageFeatures/Enhanced-Enum/semantics_A13_t01.dart
new file mode 100644
index 0000000..d6ba6a0
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A13_t01.dart
@@ -0,0 +1,57 @@
+// 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:
+/// ...
+/// The type parameters of the enum not having a well-bounded
+/// instantiate-to-bounds result and an enum element omitting the type arguments
+/// and not having arguments which valid type arguments can be inferred from
+/// (because an implicit EnumName(0, "foo", unrelatedArgs) constructor
+/// invocation requires a well-bound inferred type arguments for a generic
+/// EnumName enum)..
+///
+/// @description Check that it is a compile-time error to declare a ...
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ String toString([int index]);
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ void foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+
+ String toString();
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ void foo();
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A14_t01.dart b/LanguageFeatures/Enhanced-Enum/semantics_A14_t01.dart
new file mode 100644
index 0000000..aed434b
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A14_t01.dart
@@ -0,0 +1,47 @@
+// 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:
+/// ...
+/// Using a non-constant expression as argument of an enum value.
+///
+/// @description Check that it is a compile-time error if non-constant value is
+/// used as argument of an enum value
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+int i = 42;
+String s = "Lily was here";
+
+enum E1 {
+ e1<int>(i),
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e2<String>(s);
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+ const E1(var v);
+}
+
+enum E2<T> {
+ e1<int>(i),
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e2<String>("Type is $T");
+// ^
+// [analyzer] unspecified
+// [cfe] unspecified
+ const E2(T t);
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A15_t01.dart b/LanguageFeatures/Enhanced-Enum/semantics_A15_t01.dart
new file mode 100644
index 0000000..2e332a2
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A15_t01.dart
@@ -0,0 +1,53 @@
+// 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 static member and inheriting an instance member with the same
+/// base-name.
+///
+/// @description Check that it is a compile-time error to declare a static
+/// member and inheriting an instance member with the same base-name.
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ static int get index => 0;
+// ^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ static String toString() => "E1";
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+
+ static int get index => 0;
+// ^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ static String toString() => "E2";
+// ^^^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}