#1258. More Enhanced Enums semantics tests added
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A06_t03.dart b/LanguageFeatures/Enhanced-Enum/semantics_A06_t03.dart
index 8908da0..457697f 100644
--- a/LanguageFeatures/Enhanced-Enum/semantics_A06_t03.dart
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A06_t03.dart
@@ -42,7 +42,6 @@
final T2 t2;
}
-
main() {
Expect.equals(1, E1.e1.t1);
Expect.equals("1", E1.e1.t2);
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A06_t05.dart b/LanguageFeatures/Enhanced-Enum/semantics_A06_t05.dart
index c07ef3f..cb345ca 100644
--- a/LanguageFeatures/Enhanced-Enum/semantics_A06_t05.dart
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A06_t05.dart
@@ -67,4 +67,4 @@
Expect.equals("Lily was here", E2.e1.val2);
Expect.equals(3.14, E2.e2.val1);
Expect.equals(true, E2.e2.val2);
-}
\ No newline at end of file
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A06_t07.dart b/LanguageFeatures/Enhanced-Enum/semantics_A06_t07.dart
index ecd3bf2..9235b11 100644
--- a/LanguageFeatures/Enhanced-Enum/semantics_A06_t07.dart
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A06_t07.dart
@@ -71,4 +71,4 @@
main() {
print(E1.e1);
print(E2.e1);
-}
\ No newline at end of file
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A08_t01.dart b/LanguageFeatures/Enhanced-Enum/semantics_A08_t01.dart
new file mode 100644
index 0000000..e366fe5
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A08_t01.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2021, 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 Static `values` list: If the class does not declare or inherit a
+/// member with base-name `values`, a static constant variable named `values` is
+/// added as by the declaration `static const List<Name> values = [id1, …, idn];`
+/// where `id1…idn` are the names of the enum entries of the enum declaration in
+/// source/index order. If `Name` is generic, the `List<Name>` instantiates
+/// `Name` to its bounds.
+///
+/// @description Check that static constant named `values` is added
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+import "../../Utils/expect.dart";
+
+enum E1 {
+ e1,
+ e2,
+ e3
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+}
+
+main() {
+ Expect.equals(E1.e1, E1.values[0]);
+ Expect.equals(E1.e2, E1.values[1]);
+ Expect.equals(E1.e3, E1.values[2]);
+
+ Expect.equals(E2.e1, E2.values[0]);
+ Expect.equals(E2.e2, E2.values[1]);
+ Expect.equals(E2.e3, E2.values[2]);
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A08_t02.dart b/LanguageFeatures/Enhanced-Enum/semantics_A08_t02.dart
new file mode 100644
index 0000000..69a4b53
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A08_t02.dart
@@ -0,0 +1,67 @@
+// Copyright (c) 2021, 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 Static `values` list: If the class does not declare or inherit a
+/// member with base-name `values`, a static constant variable named `values` is
+/// added as by the declaration `static const List<Name> values = [id1, …, idn];`
+/// where `id1…idn` are the names of the enum entries of the enum declaration in
+/// source/index order. If `Name` is generic, the `List<Name>` instantiates
+/// `Name` to its bounds.
+///
+/// @description Check that if `Name` is generic, the `List<Name>` instantiates
+/// it to its bounds.
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+import "../../Utils/expect.dart";
+
+class A {
+ const A();
+}
+
+class B extends A {
+ const B();
+}
+
+class C extends A {
+ const C();
+}
+
+enum E<T extends A> {
+ e0(),
+ e1<A>(),
+ e2<B>(),
+ e3<C>();
+}
+
+main() {
+ Expect.isTrue(E.values[0] is E<A>);
+ Expect.isFalse(E.values[0] is E<B>);
+ Expect.isFalse(E.values[0] is E<C>);
+ Expect.runtimeIsType<E<A>>(E.values[0]);
+ Expect.runtimeIsNotType<E<B>>(E.values[0]);
+ Expect.runtimeIsNotType<E<C>>(E.values[0]);
+
+ Expect.isTrue(E.values[1] is E<A>);
+ Expect.isFalse(E.values[1] is E<B>);
+ Expect.isFalse(E.values[1] is E<C>);
+ Expect.runtimeIsType<E<A>>(E.values[1]);
+ Expect.runtimeIsNotType<E<B>>(E.values[1]);
+ Expect.runtimeIsNotType<E<C>>(E.values[1]);
+
+ Expect.isTrue(E.values[2] is E<A>);
+ Expect.isTrue(E.values[2] is E<B>);
+ Expect.isFalse(E.values[2] is E<C>);
+ Expect.runtimeIsType<E<A>>(E.values[2]);
+ Expect.runtimeIsType<E<B>>(E.values[2]);
+ Expect.runtimeIsNotType<E<C>>(E.values[2]);
+
+ Expect.isTrue(E.values[3] is E<A>);
+ Expect.isFalse(E.values[3] is E<B>);
+ Expect.isTrue(E.values[3] is E<C>);
+ Expect.runtimeIsType<E<A>>(E.values[3]);
+ Expect.runtimeIsNotType<E<B>>(E.values[3]);
+ Expect.runtimeIsType<E<C>>(E.values[3]);
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A09_t01.dart b/LanguageFeatures/Enhanced-Enum/semantics_A09_t01.dart
new file mode 100644
index 0000000..3ee2df8
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A09_t01.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2021, 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.
+///
+/// @description Check that if the resulting class would have any naming
+/// conflicts then compile-time error occurs.
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ final int values = 42;
+// ^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+
+ final List<E2> values = [e1, e2, e3];
+// ^^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A09_t02.dart b/LanguageFeatures/Enhanced-Enum/semantics_A09_t02.dart
new file mode 100644
index 0000000..8a57bc7
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A09_t02.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2021, 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 (from Enum or from a declared mixin or interface)
+/// any member with the same basename as an enum value which is not a static
+/// setter. (The introduced static declarations would have a conflict.)
+///
+/// @description Check that it is a compile-time error to declare any member
+/// with the same basename as enum value which is not a static setter
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ final int e1 = 42;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+ final List<E2> e2 = [];
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E3 {
+ e1,
+ e2,
+ e3;
+
+ static final int e1 = 42;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+ E3.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A09_t03.dart b/LanguageFeatures/Enhanced-Enum/semantics_A09_t03.dart
new file mode 100644
index 0000000..7fda9f6
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A09_t03.dart
@@ -0,0 +1,45 @@
+// Copyright (c) 2021, 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 (from Enum or from a declared mixin or interface)
+/// any member with the same basename as an enum value which is not a static
+/// setter. (The introduced static declarations would have a conflict.)
+///
+/// @description Check that it is a compile-time error to declare any member
+/// with the same basename as enum value which is not a static setter
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ final E1? e1;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+ final E2<String>? e2;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A09_t04.dart b/LanguageFeatures/Enhanced-Enum/semantics_A09_t04.dart
new file mode 100644
index 0000000..187a315
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A09_t04.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2021, 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 (from Enum or from a declared mixin or interface)
+/// any member with the same basename as an enum value which is not a static
+/// setter. (The introduced static declarations would have a conflict.)
+///
+/// @description Check that it is a compile-time error to declare any member
+/// with the same basename as enum value which is not a static setter
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ int get e1 => 42;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+ int get e2 => 42;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E3 {
+ e1,
+ e2,
+ e3;
+
+ static int get e1 => 42;
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+ E3.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A09_t05.dart b/LanguageFeatures/Enhanced-Enum/semantics_A09_t05.dart
new file mode 100644
index 0000000..cec8014
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A09_t05.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2021, 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 (from Enum or from a declared mixin or interface)
+/// any member with the same basename as an enum value which is not a static
+/// setter. (The introduced static declarations would have a conflict.)
+///
+/// @description Check that it is a compile-time error to declare any member
+/// with the same basename as enum value which is not a static setter
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ void set e1(int v) {};
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+ void set e2(int v) {}
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E3 {
+ e1,
+ e2,
+ e3;
+
+ static void set e1(int i) {}
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+ E3.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A09_t06.dart b/LanguageFeatures/Enhanced-Enum/semantics_A09_t06.dart
new file mode 100644
index 0000000..331f312
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A09_t06.dart
@@ -0,0 +1,57 @@
+// Copyright (c) 2021, 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 (from Enum or from a declared mixin or interface)
+/// any member with the same basename as an enum value which is not a static
+/// setter. (The introduced static declarations would have a conflict.)
+///
+/// @description Check that it is a compile-time error to declare any member
+/// with the same basename as enum value which is not a static setter
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ e3;
+
+ void e1() {};
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ e3<bool>(false);
+
+ const E2(T t);
+ void e2() {}
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E3 {
+ e1,
+ e2,
+ e3;
+
+ static void e1() {}
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+ E3.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A09_t07.dart b/LanguageFeatures/Enhanced-Enum/semantics_A09_t07.dart
new file mode 100644
index 0000000..45f66b9
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A09_t07.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2021, 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 (from Enum or from a declared mixin or interface)
+/// any member with the same basename as an enum value which is not a static
+/// setter. (The introduced static declarations would have a conflict.)
+///
+/// @description Check that it is a compile-time error to inherit any member
+/// with the same basename as enum value
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+enum E1 {
+ e1,
+ e2,
+ index;
+//^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
+
+enum E2<T> {
+ e1<int>(42),
+ e2<String>("42"),
+ index<bool>(false);
+//^^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+
+ const E2(T t);
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A09_t08.dart b/LanguageFeatures/Enhanced-Enum/semantics_A09_t08.dart
new file mode 100644
index 0000000..3a2da17
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A09_t08.dart
@@ -0,0 +1,76 @@
+// Copyright (c) 2021, 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 (from Enum or from a declared mixin or interface)
+/// any member with the same basename as an enum value which is not a static
+/// setter. (The introduced static declarations would have a conflict.)
+///
+/// @description Check that it is a compile-time error to inherit any member
+/// with the same basename as enum value
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+mixin M1 on Enum {
+ int e1() => 42;
+}
+
+mixin M2 on Enum {
+ final int e1 = 42;
+}
+
+mixin M3 on Enum {
+ int get e1 => 42;
+}
+
+mixin M4 on Enum {
+ void set e1(int v) {}
+}
+
+enum E1 with M1 {
+ e1,
+//^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e2,
+ e3;
+}
+
+enum E2 with M2 {
+ e1,
+//^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e2,
+ e3;
+}
+
+enum E3 with M3 {
+ e1,
+//^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e2,
+ e3;
+}
+
+enum E4 with M4 {
+ e1,
+//^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e2,
+ e3;
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+ E3.e1;
+ E4.e1;
+}
diff --git a/LanguageFeatures/Enhanced-Enum/semantics_A09_t09.dart b/LanguageFeatures/Enhanced-Enum/semantics_A09_t09.dart
new file mode 100644
index 0000000..b83fb6f
--- /dev/null
+++ b/LanguageFeatures/Enhanced-Enum/semantics_A09_t09.dart
@@ -0,0 +1,104 @@
+// Copyright (c) 2021, 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 (from Enum or from a declared mixin or interface)
+/// any member with the same basename as an enum value which is not a static
+/// setter. (The introduced static declarations would have a conflict.)
+///
+/// @description Check that it is a compile-time error to inherit any member
+/// with the same basename as enum value
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=enhanced-enums
+
+abstract class I1 {
+ final E1 e1 = E1.e2;
+}
+
+class I2 {
+ final int e1 = 42;
+}
+
+class I3 {
+ int get e1 => 42;
+}
+
+class I4 {
+ void set e1(int v) {}
+}
+
+abstract class I5 {
+ void e1();
+}
+
+class I6 {
+ void e1() {}
+}
+
+enum E1 implements I1 {
+ e1,
+//^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e2,
+ e3;
+}
+
+enum E2 implements I2 {
+ e1,
+//^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e2,
+ e3;
+}
+
+enum E3 implements I3 {
+ e1,
+//^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e2,
+ e3;
+}
+
+enum E4 implements I4 {
+ e1,
+//^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e2,
+ e3;
+}
+
+enum E5 implements I5 {
+ e1,
+//^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e2,
+ e3;
+}
+
+enum E6 implements I6 {
+ e1,
+//^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ e2,
+ e3;
+}
+
+main() {
+ E1.e1;
+ E2.e1;
+ E3.e1;
+ E4.e1;
+ E5.e1;
+ E6.e1;
+}