copy language/mixin tests to language/mixin_legacy with 2.19 opt out
Change-Id: Ice509ea1f0efec8153fb2380ab0e980fed552b0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289580
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
diff --git a/runtime/tests/concurrency/stress_test_list.json b/runtime/tests/concurrency/stress_test_list.json
index 1f4de6c..6984088 100644
--- a/runtime/tests/concurrency/stress_test_list.json
+++ b/runtime/tests/concurrency/stress_test_list.json
@@ -1652,8 +1652,6 @@
"../../../tests/language/mixin/generic_test.dart",
"../../../tests/language/mixin/getter_regression_test.dart",
"../../../tests/language/mixin/illegal_constructor_runtime_test.dart",
- "../../../tests/language/mixin/illegal_cycles_runtime_test.dart",
- "../../../tests/language/mixin/illegal_object_runtime_test.dart",
"../../../tests/language/mixin/illegal_static_access_runtime_test.dart",
"../../../tests/language/mixin/illegal_super_use_runtime_test.dart",
"../../../tests/language/mixin/illegal_superclass_runtime_test.dart",
diff --git a/tests/language/mixin/illegal_cycles_runtime_test.dart b/tests/language/mixin/illegal_cycles_runtime_test.dart
deleted file mode 100644
index cd5bbfe..0000000
--- a/tests/language/mixin/illegal_cycles_runtime_test.dart
+++ /dev/null
@@ -1,42 +0,0 @@
-// TODO(multitest): This was automatically migrated from a multitest and may
-// contain strange or dead code.
-
-// Copyright (c) 2013, 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.
-
-class M {}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-main() {
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-}
diff --git a/tests/language/mixin/illegal_object_runtime_test.dart b/tests/language/mixin/illegal_object_runtime_test.dart
deleted file mode 100644
index 9f8bf27..0000000
--- a/tests/language/mixin/illegal_object_runtime_test.dart
+++ /dev/null
@@ -1,21 +0,0 @@
-// TODO(multitest): This was automatically migrated from a multitest and may
-// contain strange or dead code.
-
-// Copyright (c) 2013, 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.
-
-// Object has a non-trivial constructor and hence cannot be used as mixin.
-
-class S {}
-
-class C0 extends S
-
-{}
-
-
-
-main() {
- new C0();
-
-}
diff --git a/tests/language/mixin_legacy/README.md b/tests/language/mixin_legacy/README.md
new file mode 100644
index 0000000..5f00498
--- /dev/null
+++ b/tests/language/mixin_legacy/README.md
@@ -0,0 +1,3 @@
+Tests for pre Dart 3.0 behavior of mixins.
+
+Delete this when 2.19 is no longer supported.
diff --git a/tests/language/mixin_legacy/abstract_getter_test.dart b/tests/language/mixin_legacy/abstract_getter_test.dart
new file mode 100644
index 0000000..564c590
--- /dev/null
+++ b/tests/language/mixin_legacy/abstract_getter_test.dart
@@ -0,0 +1,43 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import 'package:expect/expect.dart';
+
+abstract class B {
+ int get x;
+}
+
+class C {
+ int get x => 42;
+}
+
+class D extends C with B {
+ final int x;
+
+ D(this.x);
+}
+
+class C2 {
+ int get x => 42;
+}
+
+abstract class B2 extends C2 {
+ int get x;
+}
+
+class D2 extends B2 {
+ final int x;
+
+ D2(this.x);
+}
+
+void main() {
+ var d = new D(17);
+ Expect.equals(d.x, 17);
+
+ var d2 = new D2(17);
+ Expect.equals(d.x, 17);
+}
diff --git a/tests/language/mixin_legacy/accessor_test.dart b/tests/language/mixin_legacy/accessor_test.dart
new file mode 100644
index 0000000..2955258
--- /dev/null
+++ b/tests/language/mixin_legacy/accessor_test.dart
@@ -0,0 +1,65 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Regression test case for DDC bug where if a getter/setter is mixed in
+// without a corresponding getter/setter, DDC fails to install a the
+// corresponding getter/setter that calls super.
+
+import "package:expect/expect.dart";
+
+abstract class C<E> {
+ E get first;
+ set first(E value);
+ E operator [](int index);
+ operator []=(int index, E value);
+}
+
+abstract class CMixin<E> implements C<E> {
+ E get first => this[0];
+ set first(E x) {
+ this[0] = x;
+ }
+}
+
+abstract class CBase<E> extends Object with CMixin<E> {}
+
+abstract class DMixin<E> implements C<E> {
+ set first(E _) => throw new UnsupportedError('');
+ operator []=(int index, E value) => throw new UnsupportedError('');
+}
+
+abstract class DBase<E> = CBase<E> with DMixin<E>;
+
+class DView<E> extends DBase<E> {
+ final Iterable<E> _source;
+ DView(this._source);
+ E operator [](int index) => _source.elementAt(index);
+}
+
+abstract class FMixin<E> implements C<E> {
+ E get first => throw new UnsupportedError('');
+ E operator [](int index) => throw new UnsupportedError('');
+}
+
+class FView<E> extends CBase<E> with FMixin<E> {
+ List<E> _values;
+ FView(this._values);
+ operator []=(int index, E value) {
+ _values[index] = value;
+ }
+}
+
+void main() {
+ var d = new DView([3]);
+ Expect.equals(3, d.first);
+ Expect.throws(() => d.first = 42, (e) => e is UnsupportedError);
+
+ var list = [3];
+ var f = new FView(list);
+ f.first = 42;
+ Expect.equals(42, list[0]);
+ Expect.throws(() => f.first, (e) => e is UnsupportedError);
+}
diff --git a/tests/language/mixin_legacy/and_extension_member_test.dart b/tests/language/mixin_legacy/and_extension_member_test.dart
new file mode 100644
index 0000000..4fa55fe
--- /dev/null
+++ b/tests/language/mixin_legacy/and_extension_member_test.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import 'dart:collection';
+import 'package:expect/expect.dart';
+
+class OverrideFirstGetter {
+ get first => 9999;
+}
+
+class ListMock extends ListBase with OverrideFirstGetter {
+ final _list = [];
+ int get length => _list.length;
+ void set length(int x) {
+ _list.length = x;
+ }
+
+ operator [](x) => _list[x];
+ void operator []=(x, y) {
+ _list[x] = y;
+ }
+}
+
+// Regression test for
+// https://github.com/dart-lang/sdk/issues/29273#issuecomment-292384130
+main() {
+ List x = new ListMock();
+ x.add(42);
+ Expect.equals(42, x[0]);
+ Expect.equals(9999, x.first);
+}
diff --git a/tests/language/mixin_legacy/black_listed_test.dart b/tests/language/mixin_legacy/black_listed_test.dart
new file mode 100644
index 0000000..5dc5088
--- /dev/null
+++ b/tests/language/mixin_legacy/black_listed_test.dart
@@ -0,0 +1,61 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Check mixin of black-listed types.
+
+import 'package:expect/expect.dart';
+
+class C {}
+
+class D {}
+
+class C1 extends Object
+with String //# 01: compile-time error
+{}
+
+class D1 extends Object with C
+, Null //# 02: compile-time error
+{}
+
+class E1 extends Object
+ with
+int, //# 03: compile-time error
+ C {}
+
+class F1 extends Object
+ with
+ C
+, double //# 04: compile-time error
+ ,
+ D {}
+
+class C2 = Object with num; //# 05: compile-time error
+
+class D2 = Object with C
+, bool //# 06: compile-time error
+ ;
+
+class E2 = Object
+ with
+String, //# 07: compile-time error
+ C;
+
+class F2 = Object
+ with
+ C,
+dynamic, //# 08: compile-time error
+ D;
+
+main() {
+ Expect.isNotNull(new C1());
+ Expect.isNotNull(new D1());
+ Expect.isNotNull(new E1());
+ Expect.isNotNull(new F1());
+ Expect.isNotNull(new C2()); //# 05: continued
+ Expect.isNotNull(new D2());
+ Expect.isNotNull(new E2());
+ Expect.isNotNull(new F2());
+}
diff --git a/tests/language/mixin_legacy/bound_test.dart b/tests/language/mixin_legacy/bound_test.dart
new file mode 100644
index 0000000..1a07e59
--- /dev/null
+++ b/tests/language/mixin_legacy/bound_test.dart
@@ -0,0 +1,135 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+// library abstract_expressions;
+
+abstract class AbstractExpression {}
+
+abstract class AbstractAddition<E> {
+ E operand1, operand2;
+ AbstractAddition(this.operand1, this.operand2);
+}
+
+abstract class AbstractSubtraction<E> {
+ E operand1, operand2;
+ AbstractSubtraction(this.operand1, this.operand2);
+}
+
+abstract class AbstractNumber {
+ int val;
+ AbstractNumber(this.val);
+}
+
+// library evaluator;
+
+abstract class ExpressionWithEval {
+ int get eval;
+}
+
+abstract class AdditionWithEval<E extends ExpressionWithEval> {
+ E get operand1;
+ E get operand2;
+ int get eval => operand1.eval + operand2.eval;
+}
+
+abstract class SubtractionWithEval<E extends ExpressionWithEval> {
+ E get operand1;
+ E get operand2;
+ int get eval => operand1.eval - operand2.eval;
+}
+
+abstract class NumberWithEval {
+ int get val;
+ int get eval => val;
+}
+
+// library multiplication;
+
+abstract class AbstractMultiplication<E> {
+ E operand1, operand2;
+ AbstractMultiplication(this.operand1, this.operand2);
+}
+
+// library multiplicationEvaluator;
+
+// import 'evaluator.dart' show ExpressionWithEval;
+
+abstract class MultiplicationWithEval<E extends ExpressionWithEval> {
+ E get operand1;
+ E get operand2;
+ int get eval => operand1.eval * operand2.eval;
+}
+
+// library string_converter;
+
+abstract class ExpressionWithStringConversion {
+ String toString();
+}
+
+abstract class AdditionWithStringConversion<
+ E extends ExpressionWithStringConversion> {
+ E get operand1;
+ E get operand2;
+ String toString() => '($operand1 + $operand2))';
+}
+
+abstract class SubtractionWithStringConversion<
+ E extends ExpressionWithStringConversion> {
+ E get operand1;
+ E get operand2;
+ String toString() => '($operand1 - $operand2)';
+}
+
+abstract class NumberWithStringConversion {
+ int get val;
+ String toString() => val.toString();
+}
+
+abstract class MultiplicationWithStringConversion<
+ E extends ExpressionWithStringConversion> {
+ E get operand1;
+ E get operand2;
+ String toString() => '($operand1 * $operand2)';
+}
+
+// library expressions;
+
+// import 'abstractExpressions.dart';
+// import 'evaluator.dart';
+// import 'multiplication.dart';
+// import 'multiplicationEvaluator.dart';
+// import 'stringConverter.dart';
+
+abstract class Expression = AbstractExpression
+ with ExpressionWithEval, ExpressionWithStringConversion;
+
+class Addition = AbstractAddition<Expression>
+ with AdditionWithEval<Expression>, AdditionWithStringConversion<Expression>
+ implements Expression;
+
+class Subtraction = AbstractSubtraction<Expression>
+ with
+ SubtractionWithEval<Expression>,
+ SubtractionWithStringConversion<Expression>
+ implements Expression;
+
+class Number = AbstractNumber
+ with NumberWithEval, NumberWithStringConversion
+ implements Expression;
+
+class Multiplication = AbstractMultiplication<Expression>
+ with
+ MultiplicationWithEval<Expression>,
+ MultiplicationWithStringConversion<Expression>
+ implements Expression;
+
+void main() {
+ Expression e = new Multiplication(new Addition(new Number(4), new Number(2)),
+ new Subtraction(new Number(10), new Number(7)));
+ Expect.equals('((4 + 2)) * (10 - 7)) = 18', '$e = ${e.eval}');
+}
diff --git a/tests/language/mixin_legacy/class_from_core_library_test.dart b/tests/language/mixin_legacy/class_from_core_library_test.dart
new file mode 100644
index 0000000..5f27385
--- /dev/null
+++ b/tests/language/mixin_legacy/class_from_core_library_test.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import 'dart:collection';
+
+class MyList extends Object with ListMixin {
+ int length = 0;
+ operator [](index) => null;
+ void operator []=(index, value) {}
+}
+
+main() {
+ new MyList().length;
+}
diff --git a/tests/language/mixin_legacy/cyclic_runtime_test.dart b/tests/language/mixin_legacy/cyclic_runtime_test.dart
new file mode 100644
index 0000000..310c824
--- /dev/null
+++ b/tests/language/mixin_legacy/cyclic_runtime_test.dart
@@ -0,0 +1,26 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Test for cyclicity check on named mixin applications.
+
+class A<T> {}
+
+class S {}
+
+class M<T> {}
+
+class C1 = S with M;
+
+class C3 = S with M implements A;
+
+void main() {
+ new C1();
+
+ new C3();
+}
diff --git a/tests/language/mixin_legacy/cyclic_test.dart b/tests/language/mixin_legacy/cyclic_test.dart
new file mode 100644
index 0000000..a318358
--- /dev/null
+++ b/tests/language/mixin_legacy/cyclic_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Test for cyclicity check on named mixin applications.
+
+class A<T> {}
+
+class S {}
+
+class M<T> {}
+
+class C1 = S with M;
+class C2 = S with C2;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'C2' is a supertype of itself.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+class C3 = S with M implements A;
+class C4 = S with M implements C4;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'C4' is a supertype of itself.
+
+void main() {
+ new C1();
+ new C2();
+ new C3();
+ new C4();
+}
diff --git a/tests/language/mixin_legacy/deduplication_test.dart b/tests/language/mixin_legacy/deduplication_test.dart
new file mode 100644
index 0000000..0952f32
--- /dev/null
+++ b/tests/language/mixin_legacy/deduplication_test.dart
@@ -0,0 +1,47 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Test mixin de-duplication with new mixin syntax.
+
+import 'package:expect/expect.dart';
+
+class A {
+ int foo() => 1;
+}
+
+class B {
+ int bar() => 2;
+}
+
+abstract class C implements A, B {}
+
+mixin M1 on A, B {
+ int sum() => foo() + bar();
+}
+
+mixin M2 on A, B, M1 {
+ int sumX2() => sum() * 2;
+}
+
+class X extends C with M1, M2 {
+ int foo() => 4;
+ int bar() => 5;
+}
+
+class Y extends C with M1, M2 {
+ int foo() => 7;
+ int bar() => 10;
+}
+
+X x = new X();
+Y y = new Y();
+
+void main() {
+ Expect.equals(9, x.sum());
+ Expect.equals(18, x.sumX2());
+ Expect.equals(17, y.sum());
+ Expect.equals(34, y.sumX2());
+}
diff --git a/tests/language/mixin_legacy/extends_field_test.dart b/tests/language/mixin_legacy/extends_field_test.dart
new file mode 100644
index 0000000..b97612b
--- /dev/null
+++ b/tests/language/mixin_legacy/extends_field_test.dart
@@ -0,0 +1,124 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S {
+ var foo = "S-foo";
+}
+
+class M1 {
+ final bar = "M1-bar";
+}
+
+class M2 {
+ var baz = "M2-baz";
+}
+
+class C extends S with M1 {}
+
+class D extends S with M1, M2 {}
+
+class E extends S with M2, M1 {}
+
+class F extends E {
+ var fez = "F-fez";
+}
+
+main() {
+ dynamic c = new C();
+ dynamic d = new D();
+ dynamic e = new E();
+ dynamic f = new F();
+
+ Expect.equals("S-foo", c.foo);
+ Expect.equals("S-foo", d.foo);
+ Expect.equals("S-foo", e.foo);
+ Expect.equals("S-foo", f.foo);
+
+ Expect.equals("M1-bar", c.bar);
+ Expect.equals("M1-bar", d.bar);
+ Expect.equals("M1-bar", e.bar);
+ Expect.equals("M1-bar", f.bar);
+
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz", d.baz);
+ Expect.equals("M2-baz", e.baz);
+ Expect.equals("M2-baz", f.baz);
+
+ Expect.throwsNoSuchMethodError(() => c.fez);
+ Expect.throwsNoSuchMethodError(() => d.fez);
+ Expect.throwsNoSuchMethodError(() => e.fez);
+ Expect.equals("F-fez", f.fez);
+
+ c.foo = "S-foo-c";
+ Expect.equals("S-foo-c", c.foo);
+ Expect.equals("S-foo", d.foo);
+ Expect.equals("S-foo", e.foo);
+ Expect.equals("S-foo", f.foo);
+
+ d.foo = "S-foo-d";
+ Expect.equals("S-foo-c", c.foo);
+ Expect.equals("S-foo-d", d.foo);
+ Expect.equals("S-foo", e.foo);
+ Expect.equals("S-foo", f.foo);
+
+ e.foo = "S-foo-e";
+ Expect.equals("S-foo-c", c.foo);
+ Expect.equals("S-foo-d", d.foo);
+ Expect.equals("S-foo-e", e.foo);
+ Expect.equals("S-foo", f.foo);
+
+ f.foo = "S-foo-f";
+ Expect.equals("S-foo-c", c.foo);
+ Expect.equals("S-foo-d", d.foo);
+ Expect.equals("S-foo-e", e.foo);
+ Expect.equals("S-foo-f", f.foo);
+
+ Expect.throwsNoSuchMethodError(() => c.bar = 0);
+ Expect.throwsNoSuchMethodError(() => d.bar = 0);
+ Expect.throwsNoSuchMethodError(() => e.bar = 0);
+ Expect.throwsNoSuchMethodError(() => f.bar = 0);
+ Expect.equals("M1-bar", c.bar);
+ Expect.equals("M1-bar", d.bar);
+ Expect.equals("M1-bar", e.bar);
+ Expect.equals("M1-bar", f.bar);
+
+ Expect.throwsNoSuchMethodError(() => c.baz = 0);
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz", d.baz);
+ Expect.equals("M2-baz", e.baz);
+ Expect.equals("M2-baz", f.baz);
+
+ d.baz = "M2-baz-d";
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz-d", d.baz);
+ Expect.equals("M2-baz", e.baz);
+ Expect.equals("M2-baz", f.baz);
+ Expect.equals("M2-baz", f.baz);
+
+ e.baz = "M2-baz-e";
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz-d", d.baz);
+ Expect.equals("M2-baz-e", e.baz);
+ Expect.equals("M2-baz", f.baz);
+
+ f.baz = "M2-baz-f";
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz-d", d.baz);
+ Expect.equals("M2-baz-e", e.baz);
+ Expect.equals("M2-baz-f", f.baz);
+
+ Expect.throwsNoSuchMethodError(() => c.fez = 0);
+ Expect.throwsNoSuchMethodError(() => d.fez = 0);
+ Expect.throwsNoSuchMethodError(() => e.fez = 0);
+
+ f.fez = "F-fez-f";
+ Expect.throwsNoSuchMethodError(() => c.fez);
+ Expect.throwsNoSuchMethodError(() => d.fez);
+ Expect.throwsNoSuchMethodError(() => e.fez);
+ Expect.equals("F-fez-f", f.fez);
+}
diff --git a/tests/language/mixin_legacy/extends_is_test.dart b/tests/language/mixin_legacy/extends_is_test.dart
new file mode 100644
index 0000000..9c1b520
--- /dev/null
+++ b/tests/language/mixin_legacy/extends_is_test.dart
@@ -0,0 +1,89 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S {}
+
+class M1 {}
+
+class M2 {}
+
+class C extends S with M1 {}
+
+class D extends S with M1, M2 {}
+
+class E extends S with M2, M1 {}
+
+class F extends E {}
+
+class C_ extends S with M1 {}
+
+class D_ extends S with M1, M2 {}
+
+class E_ extends S with M2, M1 {}
+
+class F_ extends E_ {}
+
+main() {
+ var c = new C();
+ Expect.isTrue(c is C);
+ Expect.isFalse(c is D);
+ Expect.isFalse(c is E);
+ Expect.isFalse(c is F);
+ Expect.isTrue(c is S);
+ Expect.isTrue(c is M1);
+ Expect.isFalse(c is M2);
+
+ var d = new D();
+ Expect.isFalse(d is C);
+ Expect.isTrue(d is D);
+ Expect.isFalse(d is E);
+ Expect.isFalse(d is F);
+ Expect.isTrue(d is S);
+ Expect.isTrue(d is M1);
+ Expect.isTrue(d is M2);
+
+ var e = new E();
+ Expect.isFalse(e is C);
+ Expect.isFalse(e is D);
+ Expect.isTrue(e is E);
+ Expect.isFalse(e is F);
+ Expect.isTrue(e is S);
+ Expect.isTrue(e is M1);
+ Expect.isTrue(e is M2);
+
+ var f = new F();
+ Expect.isFalse(f is C);
+ Expect.isFalse(f is D);
+ Expect.isTrue(f is E);
+ Expect.isTrue(f is F);
+ Expect.isTrue(f is S);
+ Expect.isTrue(f is M1);
+ Expect.isTrue(f is M2);
+
+ // Make sure we get a new class for each mixin
+ // application (at least the named ones).
+ Expect.isFalse(c is C_);
+ Expect.isFalse(c is D_);
+ Expect.isFalse(c is E_);
+ Expect.isFalse(c is F_);
+
+ Expect.isFalse(d is C_);
+ Expect.isFalse(d is D_);
+ Expect.isFalse(d is E_);
+ Expect.isFalse(d is F_);
+
+ Expect.isFalse(e is C_);
+ Expect.isFalse(e is D_);
+ Expect.isFalse(e is E_);
+ Expect.isFalse(e is F_);
+
+ Expect.isFalse(f is C_);
+ Expect.isFalse(f is D_);
+ Expect.isFalse(f is E_);
+ Expect.isFalse(f is F_);
+}
diff --git a/tests/language/mixin_legacy/extends_method_test.dart b/tests/language/mixin_legacy/extends_method_test.dart
new file mode 100644
index 0000000..470f40a
--- /dev/null
+++ b/tests/language/mixin_legacy/extends_method_test.dart
@@ -0,0 +1,59 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S {
+ foo() => "S-foo";
+ baz() => "S-baz";
+}
+
+class M1 {
+ static m1bar() => "M1-bar";
+ bar() => m1bar();
+}
+
+class M2 {
+ bar() => "M2-bar";
+ baz() => "M2-baz";
+ fez() => "M2-fez";
+}
+
+class C extends S with M1 {}
+
+class D extends S with M1, M2 {}
+
+class E extends S with M2, M1 {}
+
+class F extends E {
+ fez() => "F-fez";
+}
+
+main() {
+ dynamic c = new C();
+ Expect.equals("S-foo", c.foo());
+ Expect.equals("M1-bar", c.bar());
+ Expect.equals("S-baz", c.baz());
+ Expect.throwsNoSuchMethodError(() => c.fez());
+
+ var d = new D();
+ Expect.equals("S-foo", d.foo());
+ Expect.equals("M2-bar", d.bar());
+ Expect.equals("M2-baz", d.baz());
+ Expect.equals("M2-fez", d.fez());
+
+ var e = new E();
+ Expect.equals("S-foo", e.foo());
+ Expect.equals("M1-bar", e.bar());
+ Expect.equals("M2-baz", e.baz());
+ Expect.equals("M2-fez", e.fez());
+
+ var f = new F();
+ Expect.equals("S-foo", f.foo());
+ Expect.equals("M1-bar", f.bar());
+ Expect.equals("M2-baz", f.baz());
+ Expect.equals("F-fez", f.fez());
+}
diff --git a/tests/language/mixin_legacy/factory_constructor_test.dart b/tests/language/mixin_legacy/factory_constructor_test.dart
new file mode 100644
index 0000000..afd9f55
--- /dev/null
+++ b/tests/language/mixin_legacy/factory_constructor_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class Base {
+ var y;
+ Base._() {
+ y = "world";
+ }
+}
+
+abstract class Mixin implements Base {
+ final x = "hello";
+ factory Mixin() => new _MixinAndBase._();
+}
+
+// TODO(jmesserly): according to the spec, this does not appear to be a valid
+// mixin (because it declares a constructor), however it is supported by Dart
+// implementations.
+class _MixinAndBase = Base with Mixin;
+
+void main() {
+ var val = new Mixin();
+ Expect.equals(val.x, "hello");
+ Expect.equals(val.y, "world");
+}
diff --git a/tests/language/mixin_legacy/field_initializer_test.dart b/tests/language/mixin_legacy/field_initializer_test.dart
new file mode 100644
index 0000000..f04228f
--- /dev/null
+++ b/tests/language/mixin_legacy/field_initializer_test.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Dart test program for testing throw statement
+
+import 'package:expect/expect.dart';
+
+class S {
+ var s1 = good_stuff();
+ static good_stuff() => "Speyburn";
+}
+
+good_stuff() => "Glenfiddich";
+
+class M {
+ var m1 = good_stuff();
+ static good_stuff() => "Macallen";
+}
+
+class A extends S with M {
+ static good_stuff() => "Ardberg";
+}
+
+main() {
+ var a = new A();
+ Expect.equals("Macallen", a.m1);
+ Expect.equals("Speyburn", a.s1);
+
+ var m = new M();
+ Expect.equals("Macallen", m.m1);
+}
diff --git a/tests/language/mixin_legacy/field_test.dart b/tests/language/mixin_legacy/field_test.dart
new file mode 100644
index 0000000..a664973
--- /dev/null
+++ b/tests/language/mixin_legacy/field_test.dart
@@ -0,0 +1,122 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S {
+ var foo = "S-foo";
+}
+
+class M1 {
+ final bar = "M1-bar";
+}
+
+class M2 {
+ var baz = "M2-baz";
+}
+
+class C = S with M1;
+class D = S with M1, M2;
+class E = S with M2, M1;
+
+class F extends E {
+ var fez = "F-fez";
+}
+
+main() {
+ dynamic c = new C();
+ dynamic d = new D();
+ dynamic e = new E();
+ dynamic f = new F();
+
+ Expect.equals("S-foo", c.foo);
+ Expect.equals("S-foo", d.foo);
+ Expect.equals("S-foo", e.foo);
+ Expect.equals("S-foo", f.foo);
+
+ Expect.equals("M1-bar", c.bar);
+ Expect.equals("M1-bar", d.bar);
+ Expect.equals("M1-bar", e.bar);
+ Expect.equals("M1-bar", f.bar);
+
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz", d.baz);
+ Expect.equals("M2-baz", e.baz);
+ Expect.equals("M2-baz", f.baz);
+
+ Expect.throwsNoSuchMethodError(() => c.fez);
+ Expect.throwsNoSuchMethodError(() => d.fez);
+ Expect.throwsNoSuchMethodError(() => e.fez);
+ Expect.equals("F-fez", f.fez);
+
+ c.foo = "S-foo-c";
+ Expect.equals("S-foo-c", c.foo);
+ Expect.equals("S-foo", d.foo);
+ Expect.equals("S-foo", e.foo);
+ Expect.equals("S-foo", f.foo);
+
+ d.foo = "S-foo-d";
+ Expect.equals("S-foo-c", c.foo);
+ Expect.equals("S-foo-d", d.foo);
+ Expect.equals("S-foo", e.foo);
+ Expect.equals("S-foo", f.foo);
+
+ e.foo = "S-foo-e";
+ Expect.equals("S-foo-c", c.foo);
+ Expect.equals("S-foo-d", d.foo);
+ Expect.equals("S-foo-e", e.foo);
+ Expect.equals("S-foo", f.foo);
+
+ f.foo = "S-foo-f";
+ Expect.equals("S-foo-c", c.foo);
+ Expect.equals("S-foo-d", d.foo);
+ Expect.equals("S-foo-e", e.foo);
+ Expect.equals("S-foo-f", f.foo);
+
+ Expect.throwsNoSuchMethodError(() => c.bar = 0);
+ Expect.throwsNoSuchMethodError(() => d.bar = 0);
+ Expect.throwsNoSuchMethodError(() => e.bar = 0);
+ Expect.throwsNoSuchMethodError(() => f.bar = 0);
+ Expect.equals("M1-bar", c.bar);
+ Expect.equals("M1-bar", d.bar);
+ Expect.equals("M1-bar", e.bar);
+ Expect.equals("M1-bar", f.bar);
+
+ Expect.throwsNoSuchMethodError(() => c.baz = 0);
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz", d.baz);
+ Expect.equals("M2-baz", e.baz);
+ Expect.equals("M2-baz", f.baz);
+
+ d.baz = "M2-baz-d";
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz-d", d.baz);
+ Expect.equals("M2-baz", e.baz);
+ Expect.equals("M2-baz", f.baz);
+ Expect.equals("M2-baz", f.baz);
+
+ e.baz = "M2-baz-e";
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz-d", d.baz);
+ Expect.equals("M2-baz-e", e.baz);
+ Expect.equals("M2-baz", f.baz);
+
+ f.baz = "M2-baz-f";
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz-d", d.baz);
+ Expect.equals("M2-baz-e", e.baz);
+ Expect.equals("M2-baz-f", f.baz);
+
+ Expect.throwsNoSuchMethodError(() => c.fez = 0);
+ Expect.throwsNoSuchMethodError(() => d.fez = 0);
+ Expect.throwsNoSuchMethodError(() => e.fez = 0);
+
+ f.fez = "F-fez-f";
+ Expect.throwsNoSuchMethodError(() => c.fez);
+ Expect.throwsNoSuchMethodError(() => d.fez);
+ Expect.throwsNoSuchMethodError(() => e.fez);
+ Expect.equals("F-fez-f", f.fez);
+}
diff --git a/tests/language/mixin_legacy/forwarding_constructor1_test.dart b/tests/language/mixin_legacy/forwarding_constructor1_test.dart
new file mode 100644
index 0000000..b9910af
--- /dev/null
+++ b/tests/language/mixin_legacy/forwarding_constructor1_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+abstract class Mixin1 {
+ var mixin1Field = 1;
+}
+
+abstract class Mixin2 {
+ var mixin2Field = 2;
+}
+
+class A {
+ var superField;
+ A(foo) : superField = foo;
+}
+
+class B extends A with Mixin1, Mixin2 {
+ var field = 4;
+ B(unused) : super(3);
+}
+
+main() {
+ var b = new B(null);
+ Expect.equals(1, b.mixin1Field);
+ Expect.equals(2, b.mixin2Field);
+ Expect.equals(3, b.superField);
+ Expect.equals(4, b.field);
+}
diff --git a/tests/language/mixin_legacy/forwarding_constructor2_test.dart b/tests/language/mixin_legacy/forwarding_constructor2_test.dart
new file mode 100644
index 0000000..af7b986
--- /dev/null
+++ b/tests/language/mixin_legacy/forwarding_constructor2_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+abstract class Mixin1 {
+ var mixin1Field = 1;
+}
+
+abstract class Mixin2 {
+ var mixin2Field = 2;
+}
+
+class A {
+ var superField;
+ A() : superField = 3;
+}
+
+class B extends A with Mixin1, Mixin2 {
+ var field = 4;
+}
+
+main() {
+ var b = new B();
+ Expect.equals(1, b.mixin1Field);
+ Expect.equals(2, b.mixin2Field);
+ Expect.equals(3, b.superField);
+ Expect.equals(4, b.field);
+}
diff --git a/tests/language/mixin_legacy/forwarding_constructor3_test.dart b/tests/language/mixin_legacy/forwarding_constructor3_test.dart
new file mode 100644
index 0000000..e690171
--- /dev/null
+++ b/tests/language/mixin_legacy/forwarding_constructor3_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Verify that a named mixin constructor forwards to the corresponding named
+// base class constructor.
+
+import "package:expect/expect.dart";
+
+abstract class Mixin1 {
+ var mixin1Field = 1;
+}
+
+abstract class Mixin2 {
+ var mixin2Field = 2;
+}
+
+class A {
+ var superField;
+ A(foo) : superField = 0;
+ A.c1(foo) : superField = foo;
+ A.c2(foo) : superField = 0;
+}
+
+class B extends A with Mixin1, Mixin2 {
+ var field = 4;
+ B(unused) : super.c1(3);
+}
+
+main() {
+ var b = new B(null);
+ Expect.equals(1, b.mixin1Field);
+ Expect.equals(2, b.mixin2Field);
+ Expect.equals(3, b.superField);
+ Expect.equals(4, b.field);
+}
diff --git a/tests/language/mixin_legacy/forwarding_constructor4_test.dart b/tests/language/mixin_legacy/forwarding_constructor4_test.dart
new file mode 100644
index 0000000..d419578
--- /dev/null
+++ b/tests/language/mixin_legacy/forwarding_constructor4_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Verify that a forwarding constructor is generated even when there is an
+// optional parameter.
+
+abstract class Mixin {}
+
+class Base {
+ Base(
+ {x} // //# 01: ok
+ {x} // //# 02: ok
+ {x} // //# 03: ok
+ );
+}
+
+class C extends Base with Mixin {
+ C(); // //# 02: continued
+ C() : super(); //# 03: continued
+}
+
+main() {
+ new C();
+}
diff --git a/tests/language/mixin_legacy/forwarding_stub_call_test.dart b/tests/language/mixin_legacy/forwarding_stub_call_test.dart
new file mode 100644
index 0000000..24c8a3b
--- /dev/null
+++ b/tests/language/mixin_legacy/forwarding_stub_call_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Test for calling a method for which a forwarding super stub has been
+// inserted.
+
+import 'package:expect/expect.dart';
+
+class Super<T> {
+ void method(T t) {}
+}
+
+class Mixin {
+ void method(int t) {}
+}
+
+// A forwarding super stub is inserted:
+//
+// void method(/*generic-covariant-impl*/ int t) => super.method(t);
+//
+class Class = Super<int> with Mixin;
+
+class Subclass extends Class {
+ void test() {
+ // Test that we can call the method.
+ super.method(0);
+ }
+}
+
+main() {
+ Super<Object> s = new Subclass()..test();
+ // Test that the covariance check is performed.
+ Expect.throws(() => s.method(''));
+}
diff --git a/tests/language/mixin_legacy/forwarding_stub_set_test.dart b/tests/language/mixin_legacy/forwarding_stub_set_test.dart
new file mode 100644
index 0000000..f9923d8
--- /dev/null
+++ b/tests/language/mixin_legacy/forwarding_stub_set_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Test for assigning to a field for which a forwarding super stub has been
+// inserted.
+
+import 'package:expect/expect.dart';
+
+class Super<T> {
+ T? field;
+}
+
+class Mixin {
+ int? field;
+}
+
+// A forwarding super stub is inserted:
+//
+// void set field(/*generic-covariant-impl*/ int t) => super.field = t;
+//
+class Class = Super<int> with Mixin;
+
+class Subclass extends Class {
+ void test() {
+ // Test that we can perform the assignment.
+ super.field = 0;
+ }
+}
+
+main() {
+ Super<Object> s = new Subclass()..test();
+ // Test that the covariance check is performed.
+ Expect.throws(() => s.field = '');
+}
diff --git a/tests/language/mixin_legacy/forwarding_stub_tearoff_test.dart b/tests/language/mixin_legacy/forwarding_stub_tearoff_test.dart
new file mode 100644
index 0000000..ad78a4d
--- /dev/null
+++ b/tests/language/mixin_legacy/forwarding_stub_tearoff_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Test for tearing off a method for which a forwarding super stub has been
+// inserted.
+
+import 'package:expect/expect.dart';
+
+class Super<T> {
+ void method(T t) {}
+}
+
+class Mixin {
+ void method(int t) {}
+}
+
+// A forwarding super stub is inserted:
+//
+// void method(/*generic-covariant-impl*/ int t) => super.method(t);
+//
+class Class = Super<int> with Mixin;
+
+class Subclass extends Class {
+ void test() {
+ // Test that we can tear off the method.
+ void Function(int) f = super.method;
+ f(0);
+ }
+}
+
+main() {
+ Super<Object> s = new Subclass()..test();
+ // Test that the covariance check is performed.
+ Expect.throws(() => s.method(''));
+}
diff --git a/tests/language/mixin_legacy/generic_test.dart b/tests/language/mixin_legacy/generic_test.dart
new file mode 100644
index 0000000..8fd06a3
--- /dev/null
+++ b/tests/language/mixin_legacy/generic_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S<T> {
+ s() {
+ return T;
+ }
+}
+
+class M<T> {
+ m() {
+ return T;
+ }
+}
+
+class N<T> {
+ n() {
+ return T;
+ }
+}
+
+class C<U, V> extends S<Map<U, V>> with M<List<U>>, N<Set<V>> {}
+
+main() {
+ var c = new C<int, bool>();
+ Expect.isTrue(c is S<Map<int, bool>>);
+ Expect.equals("Map<int, bool>", c.s().toString());
+ Expect.isTrue(c is M<List<int>>);
+ Expect.equals("List<int>", c.m().toString());
+ Expect.isTrue(c is N<Set<bool>>);
+ Expect.equals("Set<bool>", c.n().toString());
+}
diff --git a/tests/language/mixin_legacy/getter_regression_test.dart b/tests/language/mixin_legacy/getter_regression_test.dart
new file mode 100644
index 0000000..feedfbf
--- /dev/null
+++ b/tests/language/mixin_legacy/getter_regression_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Regression test case for dart2js bug where the getter for y wasn't
+// properly mixed in.
+
+import "package:expect/expect.dart";
+
+class C {
+ int x = -1;
+ int get y => x;
+}
+
+class E {
+ int z = 10;
+}
+
+class D extends E with C {
+ int w = 42;
+}
+
+main() {
+ var d = new D();
+ d.x = 37;
+ Expect.equals(37, d.x);
+ Expect.equals(10, d.z);
+ Expect.equals(42, d.w);
+ Expect.equals(37, d.y);
+}
diff --git a/tests/language/mixin_legacy/illegal_constructor_runtime_test.dart b/tests/language/mixin_legacy/illegal_constructor_runtime_test.dart
new file mode 100644
index 0000000..688d1a4
--- /dev/null
+++ b/tests/language/mixin_legacy/illegal_constructor_runtime_test.dart
@@ -0,0 +1,31 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class M0 {
+ factory M0(a, b, c) => throw "uncalled";
+ factory M0.named() => throw "uncalled";
+}
+
+class M1 {
+ M1();
+}
+
+class M2 {
+ M2.named();
+}
+
+class C0 = Object with M0;
+
+class D0 extends Object with M0 {}
+
+main() {
+ new C0();
+
+ new D0();
+}
diff --git a/tests/language/mixin_legacy/illegal_constructor_test.dart b/tests/language/mixin_legacy/illegal_constructor_test.dart
new file mode 100644
index 0000000..6c870ef
--- /dev/null
+++ b/tests/language/mixin_legacy/illegal_constructor_test.dart
@@ -0,0 +1,120 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class M0 {
+ factory M0(a, b, c) => throw "uncalled";
+ factory M0.named() => throw "uncalled";
+}
+
+class M1 {
+ M1();
+}
+
+class M2 {
+ M2.named();
+}
+
+class C0 = Object with M0;
+class C1 = Object with M1;
+// ^
+// [cfe] Can't use 'M1' as a mixin because it has constructors.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+class C2 = Object with M2;
+// ^
+// [cfe] Can't use 'M2' as a mixin because it has constructors.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+class C3 = Object with M0, M1;
+// ^
+// [cfe] Can't use 'M1' as a mixin because it has constructors.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+class C4 = Object with M1, M0;
+// ^
+// [cfe] Can't use 'M1' as a mixin because it has constructors.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+class C5 = Object with M0, M2;
+// ^
+// [cfe] Can't use 'M2' as a mixin because it has constructors.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+class C6 = Object with M2, M0;
+// ^
+// [cfe] Can't use 'M2' as a mixin because it has constructors.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+
+class D0 extends Object with M0 {}
+
+class D1 extends Object with M1 {}
+// ^
+// [cfe] Can't use 'M1' as a mixin because it has constructors.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+class D2 extends Object with M2 {}
+// ^
+// [cfe] Can't use 'M2' as a mixin because it has constructors.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+class D3 extends Object with M0, M1 {}
+// ^
+// [cfe] Can't use 'M1' as a mixin because it has constructors.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+class D4 extends Object with M1, M0 {}
+// ^
+// [cfe] Can't use 'M1' as a mixin because it has constructors.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+class D5 extends Object with M0, M2 {}
+// ^
+// [cfe] Can't use 'M2' as a mixin because it has constructors.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+class D6 extends Object with M2, M0 {}
+// ^
+// [cfe] Can't use 'M2' as a mixin because it has constructors.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+
+main() {
+ new C0();
+ new C1();
+ new C2();
+ new C3();
+ new C4();
+ new C5();
+ new C6();
+
+ new D0();
+ new D1();
+ new D2();
+ new D3();
+ new D4();
+ new D5();
+ new D6();
+
+ new C0(1, 2, 3);
+ // ^
+ // [cfe] Too many positional arguments: 0 allowed, but 3 found.
+ // ^
+ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS
+ new C0.named();
+ // ^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.NEW_WITH_UNDEFINED_CONSTRUCTOR
+ // [cfe] Couldn't find constructor 'C0.named'.
+ new D0(1, 2, 3);
+ // ^
+ // [cfe] Too many positional arguments: 0 allowed, but 3 found.
+ // ^
+ // [analyzer] COMPILE_TIME_ERROR.EXTRA_POSITIONAL_ARGUMENTS
+ new D0.named();
+ // ^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.NEW_WITH_UNDEFINED_CONSTRUCTOR
+ // [cfe] Couldn't find constructor 'D0.named'.
+}
diff --git a/tests/language/mixin_legacy/illegal_cycles_test.dart b/tests/language/mixin_legacy/illegal_cycles_test.dart
new file mode 100644
index 0000000..2b16836
--- /dev/null
+++ b/tests/language/mixin_legacy/illegal_cycles_test.dart
@@ -0,0 +1,89 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class M {}
+
+class M0 extends Object with M0 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'M0' is a supertype of itself.
+// ^
+// [cfe] 'Object with M0' is a supertype of itself.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+class M1 = Object with M1;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'M1' is a supertype of itself.
+
+class M2 = Object with M3;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'M2' is a supertype of itself.
+class M3 = Object with M2;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'M3' is a supertype of itself.
+
+class M4 = Object with M5;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'M4' is a supertype of itself.
+class M5 = Object with M6;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'M5' is a supertype of itself.
+class M6 = Object with M4;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'M6' is a supertype of itself.
+
+class M7 extends Object with M8 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'M7' is a supertype of itself.
+// ^
+// [cfe] 'Object with M8' is a supertype of itself.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+class M8 extends Object with M7 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'M8' is a supertype of itself.
+// ^
+// [cfe] 'Object with M7' is a supertype of itself.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+
+class M9 = Object with M91;
+// ^
+// [cfe] 'M9' is a supertype of itself.
+class M91 = Object with M92;
+// ^^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'M91' is a supertype of itself.
+class M92 = Object with M91;
+// ^^^
+// [analyzer] COMPILE_TIME_ERROR.RECURSIVE_INTERFACE_INHERITANCE
+// [cfe] 'M92' is a supertype of itself.
+
+main() {
+ new M0();
+
+ new M1();
+
+ new M2();
+ new M3();
+
+ new M4();
+ new M5();
+ new M6();
+
+ new M7();
+ new M8();
+
+ new M9();
+}
diff --git a/tests/language/mixin_legacy/illegal_object_test.dart b/tests/language/mixin_legacy/illegal_object_test.dart
new file mode 100644
index 0000000..13c2b48
--- /dev/null
+++ b/tests/language/mixin_legacy/illegal_object_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Object has a non-trivial constructor and hence cannot be used as mixin.
+
+class S {}
+
+class C0 extends S
+// ^
+// [cfe] Can't use 'Object' as a mixin because it has constructors.
+ with
+ Object
+// ^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+{}
+
+class C1 = S with Object;
+// ^
+// [cfe] Can't use 'Object' as a mixin because it has constructors.
+// ^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_CLASS_DECLARES_CONSTRUCTOR
+
+main() {
+ new C0();
+ new C1();
+}
diff --git a/tests/language/mixin_legacy/illegal_static_access_runtime_test.dart b/tests/language/mixin_legacy/illegal_static_access_runtime_test.dart
new file mode 100644
index 0000000..8f92f28
--- /dev/null
+++ b/tests/language/mixin_legacy/illegal_static_access_runtime_test.dart
@@ -0,0 +1,25 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S {
+ static foo() => 42;
+}
+
+class M {
+ static bar() => 87;
+}
+
+class C = S with M;
+
+main() {
+ Expect.equals(42, S.foo());
+ Expect.equals(87, M.bar());
+}
diff --git a/tests/language/mixin_legacy/illegal_static_access_test.dart b/tests/language/mixin_legacy/illegal_static_access_test.dart
new file mode 100644
index 0000000..fbdb239
--- /dev/null
+++ b/tests/language/mixin_legacy/illegal_static_access_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S {
+ static foo() => 42;
+}
+
+class M {
+ static bar() => 87;
+}
+
+class C = S with M;
+
+main() {
+ Expect.equals(42, S.foo());
+ Expect.equals(87, M.bar());
+
+ Expect.throwsNoSuchMethodError(() => C.foo());
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
+ // [cfe] Member not found: 'C.foo'.
+ Expect.throwsNoSuchMethodError(() => C.bar());
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_METHOD
+ // [cfe] Member not found: 'C.bar'.
+}
diff --git a/tests/language/mixin_legacy/illegal_super_use_runtime_test.dart b/tests/language/mixin_legacy/illegal_super_use_runtime_test.dart
new file mode 100644
index 0000000..9af3bf3
--- /dev/null
+++ b/tests/language/mixin_legacy/illegal_super_use_runtime_test.dart
@@ -0,0 +1,61 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class M {}
+
+class P0 {
+ foo() {
+ void inner() {}
+ inner();
+
+ (() {})();
+
+ return 42;
+ }
+}
+
+class P1 {
+ bar() {
+ return 87;
+ }
+
+ // The test method is strategically placed here to try to force the
+ // P1 class and its bar method to be resolved before resolving the
+ // mixin applications.
+ test() {
+ new C();
+ var d = new D();
+ var e = new E();
+ var f = new F();
+ Expect.equals(42, d.foo());
+ Expect.equals(87, e.bar());
+ Expect.equals(99, f.baz());
+ }
+}
+
+class P2 {
+ baz() {
+ return 99;
+ }
+}
+
+class C = Object with M;
+class D = Object with P0;
+class E = Object with M, P1;
+class F = Object with P2, M;
+
+main() {
+ var p1 = new P1();
+ var p2 = new P2();
+ Expect.equals(87, p1.bar());
+ p1.test();
+ Expect.equals(99, p2.baz());
+}
diff --git a/tests/language/mixin_legacy/illegal_super_use_test.dart b/tests/language/mixin_legacy/illegal_super_use_test.dart
new file mode 100644
index 0000000..97c5992
--- /dev/null
+++ b/tests/language/mixin_legacy/illegal_super_use_test.dart
@@ -0,0 +1,91 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class M {}
+
+class P0 {
+ foo() {
+ super.toString();
+ super.foo();
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
+ // [cfe] Superclass has no method named 'foo'.
+ super.bar = 100;
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
+ // [cfe] Superclass has no setter named 'bar'.
+
+ void inner() {
+ super.toString();
+ super.foo();
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
+ // [cfe] Superclass has no method named 'foo'.
+ super.bar = 100;
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
+ // [cfe] Superclass has no setter named 'bar'.
+ }
+
+ inner();
+
+ (() {
+ super.toString();
+ super.foo();
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
+ // [cfe] Superclass has no method named 'foo'.
+ super.bar = 100;
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.UNDEFINED_SUPER_MEMBER
+ // [cfe] Superclass has no setter named 'bar'.
+ })();
+
+ return 42;
+ }
+}
+
+class P1 {
+ bar() {
+ super.toString();
+ return 87;
+ }
+
+ // The test method is strategically placed here to try to force the
+ // P1 class and its bar method to be resolved before resolving the
+ // mixin applications.
+ test() {
+ new C();
+ var d = new D();
+ var e = new E();
+ var f = new F();
+ Expect.equals(42, d.foo());
+ Expect.equals(87, e.bar());
+ Expect.equals(99, f.baz());
+ }
+}
+
+class P2 {
+ baz() {
+ super.toString();
+ return 99;
+ }
+}
+
+class C = Object with M;
+class D = Object with P0;
+class E = Object with M, P1;
+class F = Object with P2, M;
+
+main() {
+ var p1 = new P1();
+ var p2 = new P2();
+ Expect.equals(87, p1.bar());
+ p1.test();
+ Expect.equals(99, p2.baz());
+}
diff --git a/tests/language/mixin_legacy/illegal_superclass_runtime_test.dart b/tests/language/mixin_legacy/illegal_superclass_runtime_test.dart
new file mode 100644
index 0000000..11b0bce
--- /dev/null
+++ b/tests/language/mixin_legacy/illegal_superclass_runtime_test.dart
@@ -0,0 +1,85 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class S0 {}
+
+class S1 extends Object {}
+
+class S2 extends S0 {}
+
+class M0 {}
+
+class M1 extends Object {}
+
+class M2 extends M0 {}
+
+class C00 = S0 with M0;
+class C01 = S0 with M1;
+
+class C03 = S0 with M0, M1;
+
+class C10 = S1 with M0;
+class C11 = S1 with M1;
+
+class C13 = S1 with M0, M1;
+
+class C20 = S2 with M0;
+class C21 = S2 with M1;
+
+class C23 = S2 with M0, M1;
+
+class D00 extends S0 with M0 {}
+
+class D01 extends S0 with M1 {}
+
+class D03 extends S0 with M0, M1 {}
+
+class D10 extends S1 with M0 {}
+
+class D11 extends S1 with M1 {}
+
+class D13 extends S1 with M0, M1 {}
+
+class D20 extends S2 with M0 {}
+
+class D21 extends S2 with M1 {}
+
+class D23 extends S2 with M0, M1 {}
+
+main() {
+ new C00();
+ new C01();
+
+ new C03();
+
+ new C10();
+ new C11();
+
+ new C13();
+
+ new C20();
+ new C21();
+
+ new C23();
+
+ new D00();
+ new D01();
+
+ new D03();
+
+ new D10();
+ new D11();
+
+ new D13();
+
+ new D20();
+ new D21();
+
+ new D23();
+}
diff --git a/tests/language/mixin_legacy/illegal_superclass_test.dart b/tests/language/mixin_legacy/illegal_superclass_test.dart
new file mode 100644
index 0000000..a23e53a
--- /dev/null
+++ b/tests/language/mixin_legacy/illegal_superclass_test.dart
@@ -0,0 +1,256 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class S0 {}
+
+class S1 extends Object {}
+
+class S2 extends S0 {}
+
+class M0 {}
+
+class M1 extends Object {}
+
+class M2 extends M0 {}
+
+class C00 = S0 with M0;
+class C01 = S0 with M1;
+class C02 = S0 with M2;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 21, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class C03 = S0 with M0, M1;
+class C04 = S0 with M0, M2;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 25, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class C05 = S0 with M2, M0;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 21, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class C06 = S0 with M1, M2;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 25, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class C07 = S0 with M2, M1;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 21, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+
+class C10 = S1 with M0;
+class C11 = S1 with M1;
+class C12 = S1 with M2;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 21, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class C13 = S1 with M0, M1;
+class C14 = S1 with M0, M2;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 25, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class C15 = S1 with M2, M0;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 21, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class C16 = S1 with M1, M2;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 25, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class C17 = S1 with M2, M1;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 21, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+
+class C20 = S2 with M0;
+class C21 = S2 with M1;
+class C22 = S2 with M2;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 21, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class C23 = S2 with M0, M1;
+class C24 = S2 with M0, M2;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 25, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class C25 = S2 with M2, M0;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 21, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class C26 = S2 with M1, M2;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 25, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class C27 = S2 with M2, M1;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 21, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+
+class D00 extends S0 with M0 {}
+
+class D01 extends S0 with M1 {}
+
+class D02 extends S0 with M2 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 27, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class D03 extends S0 with M0, M1 {}
+
+class D04 extends S0 with M0, M2 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 31, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class D05 extends S0 with M2, M0 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 27, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class D06 extends S0 with M1, M2 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 31, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class D07 extends S0 with M2, M1 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 27, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+
+class D10 extends S1 with M0 {}
+
+class D11 extends S1 with M1 {}
+
+class D12 extends S1 with M2 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 27, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class D13 extends S1 with M0, M1 {}
+
+class D14 extends S1 with M0, M2 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 31, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class D15 extends S1 with M2, M0 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 27, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class D16 extends S1 with M1, M2 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 31, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class D17 extends S1 with M2, M1 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 27, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+
+class D20 extends S2 with M0 {}
+
+class D21 extends S2 with M1 {}
+
+class D22 extends S2 with M2 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 27, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class D23 extends S2 with M0, M1 {}
+
+class D24 extends S2 with M0, M2 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 31, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class D25 extends S2 with M2, M0 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 27, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class D26 extends S2 with M1, M2 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 31, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+class D27 extends S2 with M2, M1 {}
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_INHERITS_FROM_NOT_OBJECT
+// [error column 27, length 0]
+// [cfe] The class 'M2' can't be used as a mixin because it extends a class other than 'Object'.
+
+main() {
+ new C00();
+ new C01();
+ new C02();
+ new C03();
+ new C04();
+ new C05();
+ new C06();
+ new C07();
+
+ new C10();
+ new C11();
+ new C12();
+ new C13();
+ new C14();
+ new C15();
+ new C16();
+ new C17();
+
+ new C20();
+ new C21();
+ new C22();
+ new C23();
+ new C24();
+ new C25();
+ new C26();
+ new C27();
+
+ new D00();
+ new D01();
+ new D02();
+ new D03();
+ new D04();
+ new D05();
+ new D06();
+ new D07();
+
+ new D10();
+ new D11();
+ new D12();
+ new D13();
+ new D14();
+ new D15();
+ new D16();
+ new D17();
+
+ new D20();
+ new D21();
+ new D22();
+ new D23();
+ new D24();
+ new D25();
+ new D26();
+ new D27();
+}
diff --git a/tests/language/mixin_legacy/illegal_syntax_test.dart b/tests/language/mixin_legacy/illegal_syntax_test.dart
new file mode 100644
index 0000000..80765a7
--- /dev/null
+++ b/tests/language/mixin_legacy/illegal_syntax_test.dart
@@ -0,0 +1,61 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class S { }
+class G<T> { }
+class M { }
+
+class T0 = S with M;
+abstract class T0A = S with M;
+class T1 = final S with M; // //# 01: syntax error
+class T2 = var S with M; // //# 02: syntax error
+class T3 = const S with M; // //# 03: syntax error
+class T4 = static S with M; // //# 04: syntax error
+class T5 = external S with M; // //# 05: syntax error
+class T6 = G<int> with M;
+class T7 = G<Map<String,int>> with M;
+
+class C0 extends abstract S with M { } // //# 06: syntax error
+class C1 extends final S with M { } // //# 07: syntax error
+class C2 extends var S with M { } // //# 08: syntax error
+class C3 extends const S with M { } // //# 09: syntax error
+class C4 extends static S with M { } // //# 10: syntax error
+class C5 extends external S with M { } // //# 11: syntax error
+class C6 extends G<int> with M { }
+class C7 extends G<Map<String,int>> with M { }
+
+class D0 extends S with M
+ implements M // //# 12: syntax error
+ implements M { }
+
+class D1 extends T0 { }
+
+class X = S; // //# 14: syntax error
+
+main() {
+ new T0();
+ new T0A(); // //# 13: compile-time error
+ new T1(); // //# 01: continued
+ new T2(); // //# 02: continued
+ new T3(); // //# 03: continued
+ new T4(); // //# 04: continued
+ new T5(); // //# 05: continued
+ new T6();
+ new T7();
+
+ new C0(); // //# 06: continued
+ new C1(); // //# 07: continued
+ new C2(); // //# 08: continued
+ new C3(); // //# 09: continued
+ new C4(); // //# 10: continued
+ new C5(); // //# 11: continued
+ new C6();
+ new C7();
+
+ new D0(); // //# 12: continued
+ new D1();
+ new X(); // //# 14: continued
+}
diff --git a/tests/language/mixin_legacy/implements2_test.dart b/tests/language/mixin_legacy/implements2_test.dart
new file mode 100644
index 0000000..03714161
--- /dev/null
+++ b/tests/language/mixin_legacy/implements2_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Regression test for named mixin applications with implements clause.
+
+class A {}
+
+class S {}
+
+class M {}
+
+class C = S with M implements A;
+
+void main() {
+ new C();
+}
diff --git a/tests/language/mixin_legacy/implements_test.dart b/tests/language/mixin_legacy/implements_test.dart
new file mode 100644
index 0000000..30a129d4
--- /dev/null
+++ b/tests/language/mixin_legacy/implements_test.dart
@@ -0,0 +1,79 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+abstract class I0 {
+ foo();
+}
+
+abstract class I1 {
+ bar();
+}
+
+abstract class I2 implements I0, I1 {}
+
+class M {
+ foo() => 42;
+ bar() => 87;
+}
+
+class C0 = Object with M;
+class C1 = Object with M implements I0;
+class C2 = Object with M implements I1;
+class C3 = Object with M implements I0, I1;
+class C4 = Object with M implements I1, I0;
+class C5 = Object with M implements I2;
+
+main() {
+ var c0 = new C0();
+ Expect.equals(42, c0.foo());
+ Expect.equals(87, c0.bar());
+ Expect.isTrue(c0 is M);
+ Expect.isFalse(c0 is I0);
+ Expect.isFalse(c0 is I1);
+ Expect.isFalse(c0 is I2);
+
+ var c1 = new C1();
+ Expect.equals(42, c1.foo());
+ Expect.equals(87, c1.bar());
+ Expect.isTrue(c1 is M);
+ Expect.isTrue(c1 is I0);
+ Expect.isFalse(c1 is I1);
+ Expect.isFalse(c1 is I2);
+
+ var c2 = new C2();
+ Expect.equals(42, c2.foo());
+ Expect.equals(87, c2.bar());
+ Expect.isTrue(c2 is M);
+ Expect.isFalse(c2 is I0);
+ Expect.isTrue(c2 is I1);
+ Expect.isFalse(c1 is I2);
+
+ var c3 = new C3();
+ Expect.equals(42, c3.foo());
+ Expect.equals(87, c3.bar());
+ Expect.isTrue(c3 is M);
+ Expect.isTrue(c3 is I0);
+ Expect.isTrue(c3 is I1);
+ Expect.isFalse(c1 is I2);
+
+ var c4 = new C4();
+ Expect.equals(42, c4.foo());
+ Expect.equals(87, c4.bar());
+ Expect.isTrue(c4 is M);
+ Expect.isTrue(c4 is I0);
+ Expect.isTrue(c4 is I1);
+ Expect.isFalse(c1 is I2);
+
+ var c5 = new C5();
+ Expect.equals(42, c5.foo());
+ Expect.equals(87, c5.bar());
+ Expect.isTrue(c5 is M);
+ Expect.isTrue(c5 is I0);
+ Expect.isTrue(c5 is I1);
+ Expect.isTrue(c5 is I2);
+}
diff --git a/tests/language/mixin_legacy/implicit_covariance_test.dart b/tests/language/mixin_legacy/implicit_covariance_test.dart
new file mode 100644
index 0000000..51dec47
--- /dev/null
+++ b/tests/language/mixin_legacy/implicit_covariance_test.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import 'package:expect/expect.dart';
+
+abstract class A<T> {
+ foo(T x);
+}
+
+abstract class B<T> implements A<T> {}
+
+class C {
+ foo(num x) {
+ if (x is! num) {
+ throw "Soundness issue: expected x to be num, got ${x.runtimeType}.";
+ }
+ }
+}
+
+class D<T extends num> extends C with B<T> {}
+
+class E<T extends num> = C with B<T>;
+
+test(B<dynamic> b) {
+ b.foo("bar");
+}
+
+main() {
+ Expect.throws<TypeError>(() => test(new D<int>()));
+ Expect.throws<TypeError>(() => test(new E<int>()));
+}
diff --git a/tests/language/mixin_legacy/inference_mixin_field_test.dart b/tests/language/mixin_legacy/inference_mixin_field_test.dart
new file mode 100644
index 0000000..7571e8a
--- /dev/null
+++ b/tests/language/mixin_legacy/inference_mixin_field_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class Mixin {
+ var field;
+ createIt() {
+ if (field == null) field = 42;
+ }
+}
+
+class A {
+ A(foo);
+}
+
+class B extends A with Mixin {
+ // Because [super] references a synthesized constructor, dart2js
+ // used to not see the null assignment to it.
+ B(foo) : super(foo);
+}
+
+main() {
+ var a = new B(42);
+ a.createIt();
+ Expect.equals(42, a.field);
+}
diff --git a/tests/language/mixin_legacy/interface_check_runtime_test.dart b/tests/language/mixin_legacy/interface_check_runtime_test.dart
new file mode 100644
index 0000000..4d4a19a
--- /dev/null
+++ b/tests/language/mixin_legacy/interface_check_runtime_test.dart
@@ -0,0 +1,33 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class Thing {}
+
+class SubThing extends Thing {
+ void sub() {}
+}
+
+class A {
+ Thing get thing => new Thing();
+}
+
+abstract class B implements A {
+ @override
+ SubThing get thing;
+}
+
+class C extends A //
+
+{}
+
+main() {
+ new C().thing //
+
+ ;
+}
diff --git a/tests/language/mixin_legacy/interface_check_test.dart b/tests/language/mixin_legacy/interface_check_test.dart
new file mode 100644
index 0000000..16ab862
--- /dev/null
+++ b/tests/language/mixin_legacy/interface_check_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class Thing {}
+
+class SubThing extends Thing {
+ void sub() {}
+}
+
+class A {
+ Thing get thing => new Thing();
+}
+
+abstract class B implements A {
+ @override
+ SubThing get thing;
+}
+
+class C extends A //
+// ^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_IMPLEMENTATION_OVERRIDE
+// [cfe] The implementation of 'thing' in the non-abstract class 'C' does not conform to its interface.
+ with
+ B {}
+
+main() {
+ new C()
+ .thing //
+ .sub();
+}
diff --git a/tests/language/mixin_legacy/invalid_bound2_test.dart b/tests/language/mixin_legacy/invalid_bound2_test.dart
new file mode 100644
index 0000000..62f978f
--- /dev/null
+++ b/tests/language/mixin_legacy/invalid_bound2_test.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class S0<T> {}
+
+class S<U extends num, V extends U> extends S0<String> {}
+
+class M<U extends num, V extends U> {}
+
+class A<U extends num, V extends U> extends S with M {}
+
+// A StaticWarning is reported here and in C, D, and E below, because U and V
+// are not bounded. The purpose of this test is to verify bound checking in S,
+// M, and A, the reason no bounds are declared for U and V here.
+class B<U, V> extends S<U, V> with M<int, int> {} //# 04: continued
+class B<U, V> extends S<U, V> with M<int, int> {} //# 05: continued
+class B<U, V> extends S<U, V> with M<int, int> {} //# 06: continued
+
+class C<U, V> extends S<int, int> with M<U, V> {} //# 07: continued
+class C<U, V> extends S<int, int> with M<U, V> {} //# 08: continued
+class C<U, V> extends S<int, int> with M<U, V> {} //# 09: continued
+
+class D<U, V> extends S<U, V> with M<double, int> {} //# 10: continued
+class D<U, V> extends S<U, V> with M<double, int> {} //# 11: continued
+class D<U, V> extends S<U, V> with M<double, int> {} //# 12: continued
+
+class E<U, V> extends S<double, int> with M<U, V> {} //# 13: continued
+class E<U, V> extends S<double, int> with M<U, V> {} //# 14: continued
+class E<U, V> extends S<double, int> with M<U, V> {} //# 15: continued
+
+main() {
+ new A<int, int>(); // //# 01: ok
+ new A<double, int>(); // //# 02: compile-time error
+ new A<bool, bool>(); // //# 03: compile-time error
+ new B<int, int>(); // //# 04: compile-time error
+ new B<double, int>(); // //# 05: compile-time error
+ new B<bool, bool>(); // //# 06: compile-time error
+ new C<int, int>(); // //# 07: compile-time error
+ new C<double, int>(); // //# 08: compile-time error
+ new C<bool, bool>(); // //# 09: compile-time error
+ new D<int, int>(); // //# 10: compile-time error
+ new D<double, int>(); // //# 11: compile-time error
+ new D<bool, bool>(); // //# 12: compile-time error
+ new E<int, int>(); // //# 13: compile-time error
+ new E<double, int>(); // //# 14: compile-time error
+ new E<bool, bool>(); // //# 15: compile-time error
+}
diff --git a/tests/language/mixin_legacy/invalid_bound_test.dart b/tests/language/mixin_legacy/invalid_bound_test.dart
new file mode 100644
index 0000000..daac54d
--- /dev/null
+++ b/tests/language/mixin_legacy/invalid_bound_test.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class S0<T> {}
+
+class S<T extends num> extends S0<String> {}
+
+class M<T extends num> {}
+
+class A<T extends num> extends S with M {}
+
+// A CompileTimeError is reported here and in C, D, and E below, because T is
+// not bounded. The purpose of this test is to verify bound checking in S, M,
+// and A, the reason no bound is declared for T here.
+class B<T> extends S<T> with M<int> {} //# 03: continued
+class B<T> extends S<T> with M<int> {} //# 04: continued
+
+class C<T> extends S<int> with M<T> {} //# 05: continued
+class C<T> extends S<int> with M<T> {} //# 06: continued
+
+class D<T> extends S<T> with M<bool> {} //# 07: continued
+class D<T> extends S<T> with M<bool> {} //# 08: continued
+
+class E<T> extends S<bool> with M<T> {} //# 09: continued
+class E<T> extends S<bool> with M<T> {} //# 10: continued
+
+main() {
+ new A<int>(); // //# 01: ok
+ new A<bool>(); // //# 02: compile-time error
+ new B<int>(); // //# 03: compile-time error
+ new B<bool>(); // //# 04: compile-time error
+ new C<int>(); // //# 05: compile-time error
+ new C<bool>(); // //# 06: compile-time error
+ new D<int>(); // //# 07: compile-time error
+ new D<bool>(); // //# 08: compile-time error
+ new E<int>(); // //# 09: compile-time error
+ new E<bool>(); // //# 10: compile-time error
+}
diff --git a/tests/language/mixin_legacy/invalid_inheritance1_test.dart b/tests/language/mixin_legacy/invalid_inheritance1_test.dart
new file mode 100644
index 0000000..4bb6d90
--- /dev/null
+++ b/tests/language/mixin_legacy/invalid_inheritance1_test.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class C<T> extends Object
+ with Malformed // //# 01: compile-time error
+ with T // //# 02: compile-time error
+ with T<int> // //# 03: compile-time error
+{}
+
+main() => new C<C>();
diff --git a/tests/language/mixin_legacy/invalid_inheritance2_test.dart b/tests/language/mixin_legacy/invalid_inheritance2_test.dart
new file mode 100644
index 0000000..ed27a45
--- /dev/null
+++ b/tests/language/mixin_legacy/invalid_inheritance2_test.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2023, 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.
+
+class C<T> = Object with Malformed; // //# 01: compile-time error
+class C<T> = Object with T; // //# 02: compile-time error
+class C<T> = OBject with T<int>; // //# 03: compile-time error
+
+main() {
+ new C<C>(); // //# 01: continued
+ new C<C>(); // //# 02: continued
+ new C<C>(); // //# 03: continued
+}
diff --git a/tests/language/mixin_legacy/invalid_override_in_mixin_runtime_test.dart b/tests/language/mixin_legacy/invalid_override_in_mixin_runtime_test.dart
new file mode 100644
index 0000000..4263428
--- /dev/null
+++ b/tests/language/mixin_legacy/invalid_override_in_mixin_runtime_test.dart
@@ -0,0 +1,25 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import 'package:expect/expect.dart';
+
+class A {}
+
+class C extends Object with A {
+ test() {
+ print("Hello from test");
+ }
+}
+
+main() {
+ C c = new C();
+ c.test();
+ dynamic cc = c;
+ Expect.throwsNoSuchMethodError(() => cc.doesntExist());
+}
diff --git a/tests/language/mixin_legacy/invalid_override_in_mixin_test.dart b/tests/language/mixin_legacy/invalid_override_in_mixin_test.dart
new file mode 100644
index 0000000..a85159b
--- /dev/null
+++ b/tests/language/mixin_legacy/invalid_override_in_mixin_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import 'package:expect/expect.dart';
+
+class A {
+ noSuchMethod() {}
+//^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+// [cfe] The method 'A.noSuchMethod' has fewer positional arguments than those of overridden method 'Object.noSuchMethod'.
+}
+
+class C extends Object with A {
+// ^
+// [cfe] Applying the mixin 'A' to 'Object' introduces an erroneous override of 'noSuchMethod'.
+// ^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+ test() {
+ print("Hello from test");
+ }
+}
+
+main() {
+ C c = new C();
+ c.test();
+ dynamic cc = c;
+ Expect.throwsNoSuchMethodError(() => cc.doesntExist());
+}
diff --git a/tests/language/mixin_legacy/is_test.dart b/tests/language/mixin_legacy/is_test.dart
new file mode 100644
index 0000000..340c007
--- /dev/null
+++ b/tests/language/mixin_legacy/is_test.dart
@@ -0,0 +1,85 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S {}
+
+class M1 {}
+
+class M2 {}
+
+class C = S with M1;
+class D = S with M1, M2;
+class E = S with M2, M1;
+
+class F extends E {}
+
+class C_ = S with M1;
+class D_ = S with M1, M2;
+class E_ = S with M2, M1;
+
+class F_ extends E_ {}
+
+main() {
+ var c = new C();
+ Expect.isTrue(c is C);
+ Expect.isFalse(c is D);
+ Expect.isFalse(c is E);
+ Expect.isFalse(c is F);
+ Expect.isTrue(c is S);
+ Expect.isTrue(c is M1);
+ Expect.isFalse(c is M2);
+
+ var d = new D();
+ Expect.isFalse(d is C);
+ Expect.isTrue(d is D);
+ Expect.isFalse(d is E);
+ Expect.isFalse(d is F);
+ Expect.isTrue(d is S);
+ Expect.isTrue(d is M1);
+ Expect.isTrue(d is M2);
+
+ var e = new E();
+ Expect.isFalse(e is C);
+ Expect.isFalse(e is D);
+ Expect.isTrue(e is E);
+ Expect.isFalse(e is F);
+ Expect.isTrue(e is S);
+ Expect.isTrue(e is M1);
+ Expect.isTrue(e is M2);
+
+ var f = new F();
+ Expect.isFalse(f is C);
+ Expect.isFalse(f is D);
+ Expect.isTrue(f is E);
+ Expect.isTrue(f is F);
+ Expect.isTrue(f is S);
+ Expect.isTrue(f is M1);
+ Expect.isTrue(f is M2);
+
+ // Make sure we get a new class for each mixin
+ // application (at least the named ones).
+ Expect.isFalse(c is C_);
+ Expect.isFalse(c is D_);
+ Expect.isFalse(c is E_);
+ Expect.isFalse(c is F_);
+
+ Expect.isFalse(d is C_);
+ Expect.isFalse(d is D_);
+ Expect.isFalse(d is E_);
+ Expect.isFalse(d is F_);
+
+ Expect.isFalse(e is C_);
+ Expect.isFalse(e is D_);
+ Expect.isFalse(e is E_);
+ Expect.isFalse(e is F_);
+
+ Expect.isFalse(f is C_);
+ Expect.isFalse(f is D_);
+ Expect.isFalse(f is E_);
+ Expect.isFalse(f is F_);
+}
diff --git a/tests/language/mixin_legacy/issue10216_2_test.dart b/tests/language/mixin_legacy/issue10216_2_test.dart
new file mode 100644
index 0000000..46f8eac
--- /dev/null
+++ b/tests/language/mixin_legacy/issue10216_2_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class M1 = Object with M0;
+class M2 = Object with M1;
+
+class M0 {
+ foo() => 42;
+}
+
+makeM2() {
+ return [new Object(), new M2()].last as M2;
+}
+
+main() {
+ Expect.equals(42, makeM2().foo());
+}
diff --git a/tests/language/mixin_legacy/issue10216_test.dart b/tests/language/mixin_legacy/issue10216_test.dart
new file mode 100644
index 0000000..e49f23b
--- /dev/null
+++ b/tests/language/mixin_legacy/issue10216_test.dart
@@ -0,0 +1,35 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class A {
+ foo(x, [y]) => '$x;$y';
+}
+
+class B extends A with M1, M2, M3 {}
+
+class M1 {}
+
+class M2 {
+ plain(x) => 'P $x';
+ bar(x, [y]) => '$y,$x';
+}
+
+class M3 {}
+
+makeB() {
+ return [new A(), new B()].last as B;
+}
+
+main() {
+ var b = makeB();
+ Expect.equals('1;2', b.foo(1, 2));
+ Expect.equals('2;null', b.foo(2));
+ Expect.equals('P 3', b.plain(3));
+ Expect.equals('100,4', b.bar(4, 100));
+ Expect.equals('null,5', b.bar(5));
+}
diff --git a/tests/language/mixin_legacy/lib_extends_field_lib.dart b/tests/language/mixin_legacy/lib_extends_field_lib.dart
new file mode 100644
index 0000000..5edfac7
--- /dev/null
+++ b/tests/language/mixin_legacy/lib_extends_field_lib.dart
@@ -0,0 +1,17 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+library mixin_lib_extends_field_lib;
+
+mixin M1 {
+ final bar = "M1-bar";
+}
+
+mixin M2 {
+ var baz = "M2-$_baz";
+}
+
+var _baz = "baz";
diff --git a/tests/language/mixin_legacy/lib_extends_field_test.dart b/tests/language/mixin_legacy/lib_extends_field_test.dart
new file mode 100644
index 0000000..2e2117e
--- /dev/null
+++ b/tests/language/mixin_legacy/lib_extends_field_test.dart
@@ -0,0 +1,119 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+library mixin_lib_extends_field_test;
+
+import 'package:expect/expect.dart';
+import "lib_extends_field_lib.dart" as L;
+
+class S {
+ var foo = "S-foo";
+}
+
+class C extends S with L.M1 {}
+
+class D extends S with L.M1, L.M2 {}
+
+class E extends S with L.M2, L.M1 {}
+
+class F extends E {
+ var fez = "F-fez";
+}
+
+main() {
+ dynamic c = new C();
+ dynamic d = new D();
+ dynamic e = new E();
+ dynamic f = new F();
+
+ Expect.equals("S-foo", c.foo);
+ Expect.equals("S-foo", d.foo);
+ Expect.equals("S-foo", e.foo);
+ Expect.equals("S-foo", f.foo);
+
+ Expect.equals("M1-bar", c.bar);
+ Expect.equals("M1-bar", d.bar);
+ Expect.equals("M1-bar", e.bar);
+ Expect.equals("M1-bar", f.bar);
+
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz", d.baz);
+ Expect.equals("M2-baz", e.baz);
+ Expect.equals("M2-baz", f.baz);
+
+ Expect.throwsNoSuchMethodError(() => c.fez);
+ Expect.throwsNoSuchMethodError(() => d.fez);
+ Expect.throwsNoSuchMethodError(() => e.fez);
+ Expect.equals("F-fez", f.fez);
+
+ c.foo = "S-foo-c";
+ Expect.equals("S-foo-c", c.foo);
+ Expect.equals("S-foo", d.foo);
+ Expect.equals("S-foo", e.foo);
+ Expect.equals("S-foo", f.foo);
+
+ d.foo = "S-foo-d";
+ Expect.equals("S-foo-c", c.foo);
+ Expect.equals("S-foo-d", d.foo);
+ Expect.equals("S-foo", e.foo);
+ Expect.equals("S-foo", f.foo);
+
+ e.foo = "S-foo-e";
+ Expect.equals("S-foo-c", c.foo);
+ Expect.equals("S-foo-d", d.foo);
+ Expect.equals("S-foo-e", e.foo);
+ Expect.equals("S-foo", f.foo);
+
+ f.foo = "S-foo-f";
+ Expect.equals("S-foo-c", c.foo);
+ Expect.equals("S-foo-d", d.foo);
+ Expect.equals("S-foo-e", e.foo);
+ Expect.equals("S-foo-f", f.foo);
+
+ Expect.throwsNoSuchMethodError(() => c.bar = 0);
+ Expect.throwsNoSuchMethodError(() => d.bar = 0);
+ Expect.throwsNoSuchMethodError(() => e.bar = 0);
+ Expect.throwsNoSuchMethodError(() => f.bar = 0);
+ Expect.equals("M1-bar", c.bar);
+ Expect.equals("M1-bar", d.bar);
+ Expect.equals("M1-bar", e.bar);
+ Expect.equals("M1-bar", f.bar);
+
+ Expect.throwsNoSuchMethodError(() => c.baz = 0);
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz", d.baz);
+ Expect.equals("M2-baz", e.baz);
+ Expect.equals("M2-baz", f.baz);
+
+ d.baz = "M2-baz-d";
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz-d", d.baz);
+ Expect.equals("M2-baz", e.baz);
+ Expect.equals("M2-baz", f.baz);
+ Expect.equals("M2-baz", f.baz);
+
+ e.baz = "M2-baz-e";
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz-d", d.baz);
+ Expect.equals("M2-baz-e", e.baz);
+ Expect.equals("M2-baz", f.baz);
+
+ f.baz = "M2-baz-f";
+ Expect.throwsNoSuchMethodError(() => c.baz);
+ Expect.equals("M2-baz-d", d.baz);
+ Expect.equals("M2-baz-e", e.baz);
+ Expect.equals("M2-baz-f", f.baz);
+
+ Expect.throwsNoSuchMethodError(() => c.fez = 0);
+ Expect.throwsNoSuchMethodError(() => d.fez = 0);
+ Expect.throwsNoSuchMethodError(() => e.fez = 0);
+
+ f.fez = "F-fez-f";
+ Expect.throwsNoSuchMethodError(() => c.fez);
+ Expect.throwsNoSuchMethodError(() => d.fez);
+ Expect.throwsNoSuchMethodError(() => e.fez);
+ Expect.equals("F-fez-f", f.fez);
+}
diff --git a/tests/language/mixin_legacy/lib_extends_method_lib.dart b/tests/language/mixin_legacy/lib_extends_method_lib.dart
new file mode 100644
index 0000000..5379385
--- /dev/null
+++ b/tests/language/mixin_legacy/lib_extends_method_lib.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+library mixin_lib_extends_method_lib;
+
+mixin M1 {
+ bar() => "M1-bar";
+
+ clo(s) {
+ var l = s;
+ return (s) => "$l$s";
+ }
+}
+
+mixin M2 {
+ // Make sure mixed-in method has access to library-private names.
+ bar() => _M2_bar();
+ baz() => _M2_baz;
+ fez() => "M2-${_fez()}";
+ _fez() => "fez";
+}
+
+_M2_bar() {
+ return "M2-bar";
+}
+
+var _M2_baz = "M2-baz";
diff --git a/tests/language/mixin_legacy/lib_extends_method_test.dart b/tests/language/mixin_legacy/lib_extends_method_test.dart
new file mode 100644
index 0000000..2ff698c
--- /dev/null
+++ b/tests/language/mixin_legacy/lib_extends_method_test.dart
@@ -0,0 +1,55 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+library mixin_lib_extends_method_test;
+
+import "package:expect/expect.dart";
+import "lib_extends_method_lib.dart" as L;
+
+class S {
+ foo() => "S-foo";
+ baz() => "S-baz";
+}
+
+class C extends S with L.M1 {}
+
+class D extends S with L.M1, L.M2 {}
+
+class E extends S with L.M2, L.M1 {}
+
+class F extends E {
+ fez() => "F-fez";
+}
+
+main() {
+ dynamic c = new C();
+ Expect.equals("S-foo", c.foo());
+ Expect.equals("M1-bar", c.bar());
+ Expect.equals("S-baz", c.baz());
+ Expect.throwsNoSuchMethodError(() => c.fez());
+ Expect.equals("sugus", c.clo("su")("gus"));
+
+ var d = new D();
+ Expect.equals("S-foo", d.foo());
+ Expect.equals("M2-bar", d.bar());
+ Expect.equals("M2-baz", d.baz());
+ Expect.equals("M2-fez", d.fez());
+ Expect.equals("sugus", d.clo("su")("gus"));
+
+ var e = new E();
+ Expect.equals("S-foo", e.foo());
+ Expect.equals("M1-bar", e.bar());
+ Expect.equals("M2-baz", e.baz());
+ Expect.equals("M2-fez", e.fez());
+ Expect.equals("sugus", e.clo("su")("gus"));
+
+ var f = new F();
+ Expect.equals("S-foo", f.foo());
+ Expect.equals("M1-bar", f.bar());
+ Expect.equals("M2-baz", f.baz());
+ Expect.equals("F-fez", f.fez());
+ Expect.equals("sugus", f.clo("su")("gus"));
+}
diff --git a/tests/language/mixin_legacy/method_override_runtime_test.dart b/tests/language/mixin_legacy/method_override_runtime_test.dart
new file mode 100644
index 0000000..f365d07
--- /dev/null
+++ b/tests/language/mixin_legacy/method_override_runtime_test.dart
@@ -0,0 +1,150 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Signature conformance test.
+abstract class CII {
+ int id(int x);
+}
+
+class CSI {
+ String id(int x) => "$x";
+}
+
+class CIS {
+ int id(String x) => 0;
+}
+
+class CTT<T> {
+ T id(T x) => x;
+}
+
+// Wrong return type.
+
+// Wrong argument type.
+
+// Similar as the above but using an instantiated class instead.
+abstract class C5 = CII with CTT<int>;
+
+abstract class C6 extends CII with CTT<int> {}
+
+// Named parameters
+abstract class NIIx {
+ int? id({int? x}) => x;
+}
+
+class NIIxy {
+ int? id({int? x, int? y}) => y;
+}
+
+class NIIy {
+ int? id({int? y}) => y;
+}
+
+class NII {
+ int? id(int? x) => x;
+}
+
+// It's OK to introduce more named parameters.
+abstract class N1 = NIIx with NIIxy;
+
+abstract class N2 extends NIIx with NIIxy {}
+// It's NOT OK to rename named parameters.
+
+// It's NOT OK to drop named parameters.
+
+class NBABxy<A, B> {
+ B? id({A? x, B? y}) => y;
+}
+
+class NTTy<T> {
+ T? id({T? y}) => y;
+}
+
+class NTTx<T> {
+ T? id(T? x) => x;
+}
+
+// Same as above but with generic classes.
+abstract class N7 = NIIx with NBABxy<int, int>;
+
+abstract class N8 extends NIIx with NBABxy<int, int> {}
+
+// Optional positional parameters
+abstract class OII {
+ int? id([int? x]) => x;
+}
+
+class OIII {
+ int? id([int? x, int? y]) => y;
+}
+
+class OIIy {
+ int? id([int? y]) => y;
+}
+
+class PII {
+ int? id(int? x) => x;
+}
+
+// It's OK to introduce more optional parameters.
+abstract class O1 = OII with OIII;
+
+abstract class O2 extends OII with OIII {}
+
+// It's OK to rename optional parameters.
+abstract class O3 = OII with OIIy;
+
+abstract class O4 extends OII with OIIy {}
+// It's NOT OK to drop optional parameters.
+
+class OBAB<A, B> {
+ B? id([A? x, B? y]) => y;
+}
+
+class OTTy<T> {
+ T? id([T? y]) => y;
+}
+
+class PTT<T> {
+ T? id(T? x) => x;
+}
+
+// Same as above but with generic classes.
+abstract class O7 = OII with OBAB<int, int>;
+
+abstract class O8 extends OII with OBAB<int, int> {}
+
+abstract class O11 = OII with OTTy<int>;
+
+abstract class O12 extends OII with OTTy<int> {}
+
+// More tests with generic classes.
+abstract class GTTnum {
+ T id<T extends num>(x);
+}
+
+class MTTnum {
+ T id<T extends num>(x) => x;
+}
+
+class MTTint {
+ T id<T extends int>(x) => x;
+}
+
+class MTT {
+ T id<T>(x) => x;
+}
+
+class MTTnumR {
+ T id<T extends num, R>(x) => x;
+}
+
+class G1 = GTTnum with MTTnum;
+
+void main() {}
diff --git a/tests/language/mixin_legacy/method_override_test.dart b/tests/language/mixin_legacy/method_override_test.dart
new file mode 100644
index 0000000..5ddf772
--- /dev/null
+++ b/tests/language/mixin_legacy/method_override_test.dart
@@ -0,0 +1,285 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Signature conformance test.
+abstract class CII {
+ int id(int x);
+}
+
+class CSI {
+ String id(int x) => "$x";
+}
+
+class CIS {
+ int id(String x) => 0;
+}
+
+class CTT<T> {
+ T id(T x) => x;
+}
+
+// Wrong return type.
+abstract class C1 = CII with CIS;
+// ^
+// [cfe] The mixin application class 'C1' introduces an erroneous override of 'id'.
+// ^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class C2 extends CII with CIS {}
+// ^
+// [cfe] Applying the mixin 'CIS' to 'CII' introduces an erroneous override of 'id'.
+// ^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+
+// Wrong argument type.
+abstract class C3 = CII with CSI;
+// ^
+// [cfe] The mixin application class 'C3' introduces an erroneous override of 'id'.
+// ^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class C4 extends CII with CSI {}
+// ^
+// [cfe] Applying the mixin 'CSI' to 'CII' introduces an erroneous override of 'id'.
+// ^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+
+// Similar as the above but using an instantiated class instead.
+abstract class C5 = CII with CTT<int>;
+
+abstract class C6 extends CII with CTT<int> {}
+
+abstract class C7 = CII with CTT<String>;
+// ^
+// [cfe] The mixin application class 'C7' introduces an erroneous override of 'id'.
+// ^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class C8 extends CII with CTT<String> {}
+// ^
+// [cfe] Applying the mixin 'CTT' to 'CII' introduces an erroneous override of 'id'.
+// ^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+
+// Named parameters
+abstract class NIIx {
+ int? id({int? x}) => x;
+}
+
+class NIIxy {
+ int? id({int? x, int? y}) => y;
+}
+
+class NIIy {
+ int? id({int? y}) => y;
+}
+
+class NII {
+ int? id(int? x) => x;
+}
+
+// It's OK to introduce more named parameters.
+abstract class N1 = NIIx with NIIxy;
+
+abstract class N2 extends NIIx with NIIxy {}
+
+// It's NOT OK to rename named parameters.
+abstract class N3 = NIIx with NIIy;
+// ^
+// [cfe] The mixin application class 'N3' introduces an erroneous override of 'id'.
+// ^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class N4 extends NIIx with NIIy {}
+// ^
+// [cfe] Applying the mixin 'NIIy' to 'NIIx' introduces an erroneous override of 'id'.
+// ^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+
+// It's NOT OK to drop named parameters.
+abstract class N5 = NIIx with NII;
+// ^
+// [cfe] The mixin application class 'N5' introduces an erroneous override of 'id'.
+// ^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class N6 extends NIIx with NII {}
+// ^
+// [cfe] Applying the mixin 'NII' to 'NIIx' introduces an erroneous override of 'id'.
+// ^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+
+class NBABxy<A, B> {
+ B? id({A? x, B? y}) => y;
+}
+
+class NTTy<T> {
+ T? id({T? y}) => y;
+}
+
+class NTTx<T> {
+ T? id(T? x) => x;
+}
+
+// Same as above but with generic classes.
+abstract class N7 = NIIx with NBABxy<int, int>;
+
+abstract class N8 extends NIIx with NBABxy<int, int> {}
+
+abstract class N9 = NIIx with NBABxy<String, int>;
+// ^
+// [cfe] The mixin application class 'N9' introduces an erroneous override of 'id'.
+// ^^^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class N10 extends NIIx with NBABxy<String, int> {}
+// ^
+// [cfe] Applying the mixin 'NBABxy' to 'NIIx' introduces an erroneous override of 'id'.
+// ^^^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class N11 = NIIx with NTTy<int>;
+// ^
+// [cfe] The mixin application class 'N11' introduces an erroneous override of 'id'.
+// ^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class N12 extends NIIx with NTTy<int> {}
+// ^
+// [cfe] Applying the mixin 'NTTy' to 'NIIx' introduces an erroneous override of 'id'.
+// ^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class N13 = NIIx with NTTx<int>;
+// ^
+// [cfe] The mixin application class 'N13' introduces an erroneous override of 'id'.
+// ^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class N14 extends NIIx with NTTx<int> {}
+// ^
+// [cfe] Applying the mixin 'NTTx' to 'NIIx' introduces an erroneous override of 'id'.
+// ^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+
+// Optional positional parameters
+abstract class OII {
+ int? id([int? x]) => x;
+}
+
+class OIII {
+ int? id([int? x, int? y]) => y;
+}
+
+class OIIy {
+ int? id([int? y]) => y;
+}
+
+class PII {
+ int? id(int? x) => x;
+}
+
+// It's OK to introduce more optional parameters.
+abstract class O1 = OII with OIII;
+
+abstract class O2 extends OII with OIII {}
+
+// It's OK to rename optional parameters.
+abstract class O3 = OII with OIIy;
+
+abstract class O4 extends OII with OIIy {}
+
+// It's NOT OK to drop optional parameters.
+abstract class O5 = OII with PII;
+// ^
+// [cfe] The mixin application class 'O5' introduces an erroneous override of 'id'.
+// ^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class O6 extends OII with PII {}
+// ^
+// [cfe] Applying the mixin 'PII' to 'OII' introduces an erroneous override of 'id'.
+// ^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+
+class OBAB<A, B> {
+ B? id([A? x, B? y]) => y;
+}
+
+class OTTy<T> {
+ T? id([T? y]) => y;
+}
+
+class PTT<T> {
+ T? id(T? x) => x;
+}
+
+// Same as above but with generic classes.
+abstract class O7 = OII with OBAB<int, int>;
+
+abstract class O8 extends OII with OBAB<int, int> {}
+
+abstract class O9 = OII with OBAB<String, int>;
+// ^
+// [cfe] The mixin application class 'O9' introduces an erroneous override of 'id'.
+// ^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class O10 extends OII with OBAB<String, int> {}
+// ^
+// [cfe] Applying the mixin 'OBAB' to 'OII' introduces an erroneous override of 'id'.
+// ^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class O11 = OII with OTTy<int>;
+
+abstract class O12 extends OII with OTTy<int> {}
+
+abstract class O13 = OII with PTT<int>;
+// ^
+// [cfe] The mixin application class 'O13' introduces an erroneous override of 'id'.
+// ^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+abstract class O14 extends OII with PTT<int> {}
+// ^
+// [cfe] Applying the mixin 'PTT' to 'OII' introduces an erroneous override of 'id'.
+// ^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+
+// More tests with generic classes.
+abstract class GTTnum {
+ T id<T extends num>(x);
+}
+
+class MTTnum {
+ T id<T extends num>(x) => x;
+}
+
+class MTTint {
+ T id<T extends int>(x) => x;
+}
+
+class MTT {
+ T id<T>(x) => x;
+}
+
+class MTTnumR {
+ T id<T extends num, R>(x) => x;
+}
+
+class G1 = GTTnum with MTTnum;
+class G2 = GTTnum with MTTint;
+// ^
+// [cfe] The mixin application class 'G2' introduces an erroneous override of 'id'.
+// ^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+class G3 = GTTnum with MTT;
+// ^
+// [cfe] The mixin application class 'G3' introduces an erroneous override of 'id'.
+// ^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+class G4 = GTTnum with MTTnumR;
+// ^
+// [cfe] The mixin application class 'G4' introduces an erroneous override of 'id'.
+// ^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+class G5 = GTTnum with CII;
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER
+// [cfe] The mixin application class 'G5' introduces an erroneous override of 'id'.
+// ^
+// [cfe] The non-abstract class 'G5' is missing implementations for these members:
+// ^^^
+// [analyzer] COMPILE_TIME_ERROR.INVALID_OVERRIDE
+
+void main() {}
diff --git a/tests/language/mixin_legacy/method_test.dart b/tests/language/mixin_legacy/method_test.dart
new file mode 100644
index 0000000..063d481
--- /dev/null
+++ b/tests/language/mixin_legacy/method_test.dart
@@ -0,0 +1,56 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S {
+ foo() => "S-foo";
+ baz() => "S-baz";
+}
+
+class M1 {
+ bar() => "M1-bar";
+}
+
+class M2 {
+ bar() => "M2-bar";
+ baz() => "M2-baz";
+ fez() => "M2-fez";
+}
+
+class C = S with M1;
+class D = S with M1, M2;
+class E = S with M2, M1;
+
+class F extends E {
+ fez() => "F-fez";
+}
+
+main() {
+ dynamic c = new C();
+ Expect.equals("S-foo", c.foo());
+ Expect.equals("M1-bar", c.bar());
+ Expect.equals("S-baz", c.baz());
+ Expect.throwsNoSuchMethodError(() => c.fez());
+
+ var d = new D();
+ Expect.equals("S-foo", d.foo());
+ Expect.equals("M2-bar", d.bar());
+ Expect.equals("M2-baz", d.baz());
+ Expect.equals("M2-fez", d.fez());
+
+ var e = new E();
+ Expect.equals("S-foo", e.foo());
+ Expect.equals("M1-bar", e.bar());
+ Expect.equals("M2-baz", e.baz());
+ Expect.equals("M2-fez", e.fez());
+
+ var f = new F();
+ Expect.equals("S-foo", f.foo());
+ Expect.equals("M1-bar", f.bar());
+ Expect.equals("M2-baz", f.baz());
+ Expect.equals("F-fez", f.fez());
+}
diff --git a/tests/language/mixin_legacy/mixin2_test.dart b/tests/language/mixin_legacy/mixin2_test.dart
new file mode 100644
index 0000000..c599987
--- /dev/null
+++ b/tests/language/mixin_legacy/mixin2_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class M<T> {
+ t() {
+ return T;
+ }
+}
+
+class A<U> = Object with M<U>;
+
+class B<V> = Object with A<V>;
+
+class C<U> = Object with M<List<U>>;
+
+class D<V> = Object with C<Set<V>>;
+
+class E extends A<num> {}
+
+class F extends B<String> {}
+
+class G<T> extends C<T> {}
+
+class H<T> extends D<Map<String, T>> {}
+
+main() {
+ Expect.equals("num", new E().t().toString());
+ Expect.equals("String", new F().t().toString());
+ Expect.equals("List<bool>", new G<bool>().t().toString());
+ Expect.equals("List<Set<Map<String, int>>>", new H<int>().t().toString());
+}
diff --git a/tests/language/mixin_legacy/mixin3_test.dart b/tests/language/mixin_legacy/mixin3_test.dart
new file mode 100644
index 0000000..5593480
--- /dev/null
+++ b/tests/language/mixin_legacy/mixin3_test.dart
@@ -0,0 +1,53 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class M<T> {
+ t() {
+ return T;
+ }
+}
+
+class A<U> = Object with M<List<U>>;
+
+class B0 = Object with A<Set<bool>>;
+
+class B1 = Object with A<Set<int>>;
+
+class C0 extends B0 {}
+
+class C1 extends B1 {}
+
+class A2<K, V> = Object with M<Map<K, V>>;
+
+class B2<V> = Object with A2<Set<V>, List<V>>;
+
+class B3<K, V> = Object with A2<Set<K>, List<V>>;
+
+class C2<T> extends B2<T> {}
+
+class C3<T> extends B3<T, int> {}
+
+class N {
+ q() {
+ return 42;
+ }
+}
+
+class O<U> = Object with N;
+
+class P<K, V> = Object with O<V>;
+
+class Q<K, V> extends P<K, V> {}
+
+main() {
+ Expect.equals("List<Set<bool>>", new C0().t().toString());
+ Expect.equals("List<Set<int>>", new C1().t().toString());
+ Expect.equals("Map<Set<bool>, List<bool>>", new C2<bool>().t().toString());
+ Expect.equals("Map<Set<bool>, List<int>>", new C3<bool>().t().toString());
+ Expect.equals(42, new Q<bool, int>().q());
+}
diff --git a/tests/language/mixin_legacy/mixin4_test.dart b/tests/language/mixin_legacy/mixin4_test.dart
new file mode 100644
index 0000000..aa3457b
--- /dev/null
+++ b/tests/language/mixin_legacy/mixin4_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class I<T> {}
+
+class J<T> {}
+
+class S<T> {}
+
+class M<T> {
+ t() {
+ return T;
+ }
+}
+
+class A<U, V> = Object with M<Map<U, V>> implements I<V>;
+
+class C<T, K> = S<T> with A<T, List<K>> implements J<K>;
+
+main() {
+ var c = new C<int, bool>();
+ Expect.equals("Map<int, List<bool>>", c.t().toString());
+ Expect.isTrue(c is I<List<bool>>);
+ Expect.isTrue(c is J<bool>);
+ Expect.isTrue(c is S<int>);
+ Expect.isTrue(c is A<int, List<bool>>);
+ Expect.isTrue(c is M<Map<int, List<bool>>>);
+}
diff --git a/tests/language/mixin_legacy/mixin5_test.dart b/tests/language/mixin_legacy/mixin5_test.dart
new file mode 100644
index 0000000..b00af7f
--- /dev/null
+++ b/tests/language/mixin_legacy/mixin5_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class I<T> {}
+
+class J<T> {}
+
+class K<T> {}
+
+class S<T> {}
+
+class M<T> {
+ m() {
+ return T;
+ }
+}
+
+class A<U, V> = Object with M<Map<U, V>> implements I<V>;
+
+class B<T> = Object with A<T, Set<T>> implements J<T>;
+
+class C<T> = S<List<T>> with B<List<T>> implements K<T>;
+
+main() {
+ var c = new C<int>();
+ Expect.equals("Map<List<int>, Set<List<int>>>", c.m().toString());
+ Expect.isTrue(c is K<int>);
+ Expect.isTrue(c is J<List<int>>);
+ Expect.isTrue(c is I<Set<List<int>>>);
+ Expect.isTrue(c is S<List<int>>);
+ Expect.isTrue(c is A<List<int>, Set<List<int>>>);
+ Expect.isTrue(c is M<Map<List<int>, Set<List<int>>>>);
+}
diff --git a/tests/language/mixin_legacy/mixin6_test.dart b/tests/language/mixin_legacy/mixin6_test.dart
new file mode 100644
index 0000000..90a1d6f
--- /dev/null
+++ b/tests/language/mixin_legacy/mixin6_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class I<T> {}
+
+class J<T> {}
+
+class K<T> {}
+
+class S<T> {}
+
+class M<T> {
+ m() {
+ return T;
+ }
+}
+
+class A<U, V> = Object with M<Map<U, V>> implements I<V>;
+
+class B<T> = Object with A<T, Set<T>> implements J<T>;
+
+class C<T> = S<List<T>> with B implements K<T>; // B is raw.
+
+main() {
+ var c = new C<int>();
+ Expect.equals("Map<dynamic, Set<dynamic>>", c.m().toString());
+ Expect.isTrue(c is K<int>);
+ Expect.isTrue(c is J);
+ Expect.isTrue(c is I<Set>);
+ Expect.isTrue(c is S<List<int>>);
+ Expect.isTrue(c is A<dynamic, Set>);
+ Expect.isTrue(c is M<Map<dynamic, Set>>);
+}
diff --git a/tests/language/mixin_legacy/mixin7_test.dart b/tests/language/mixin_legacy/mixin7_test.dart
new file mode 100644
index 0000000..603913a
--- /dev/null
+++ b/tests/language/mixin_legacy/mixin7_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class I<T> {}
+
+class J<T> {}
+
+class K<T> {}
+
+class S<T> {}
+
+class M<T> {
+ m() {
+ return T;
+ }
+}
+
+class A<U, V> = Object with M implements I<V>; // M is raw.
+
+class B<T> = Object with A implements J<T>; // A is raw.
+
+class C<T> = S<List<T>> with B implements K<T>; // B is raw.
+
+main() {
+ var c = new C<int>();
+ Expect.equals("dynamic", c.m().toString());
+ Expect.isTrue(c is K<int>);
+ Expect.isTrue(c is J);
+ Expect.isTrue(c is I);
+ Expect.isTrue(c is S<List<int>>);
+ Expect.isTrue(c is A);
+ Expect.isTrue(c is M);
+}
diff --git a/tests/language/mixin_legacy/mixin_bound2_test.dart b/tests/language/mixin_legacy/mixin_bound2_test.dart
new file mode 100644
index 0000000..2a69bb8
--- /dev/null
+++ b/tests/language/mixin_legacy/mixin_bound2_test.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class I<T> {}
+
+class J<T> {}
+
+class K<T> {}
+
+class S<U extends Set<V>, V> {}
+
+class M<U, V, T extends Map<U, V>> {
+ m() {
+ return T;
+ }
+}
+
+class A<U, V extends Set<U>> = Object with M<U, V, Map<U, V>> implements I<V>;
+
+class B<T extends List<num>> = Object with A<T, Set<T>> implements J<T>;
+
+class C<T extends num> = S<Set<T>, T> with B<List<T>> implements K<T>;
+
+main() {
+ var c = new C<int>();
+ Expect.equals("Map<List<int>, Set<List<int>>>", c.m().toString());
+ Expect.isTrue(c is K<int>);
+ Expect.isTrue(c is J<List<int>>);
+ Expect.isTrue(c is I<Set<List<int>>>);
+ Expect.isTrue(c is S<Set<int>, int>);
+ Expect.isTrue(c is A<List<int>, Set<List<int>>>);
+ Expect.isTrue(
+ c is M<List<int>, Set<List<int>>, Map<List<int>, Set<List<int>>>>);
+}
diff --git a/tests/language/mixin_legacy/mixin_bound_test.dart b/tests/language/mixin_legacy/mixin_bound_test.dart
new file mode 100644
index 0000000..370e350
--- /dev/null
+++ b/tests/language/mixin_legacy/mixin_bound_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class I<T> {}
+
+class J<T> {}
+
+class S<U extends Set<V>, V> {}
+
+class M<U, V, T extends Map<U, V>> {
+ t() {
+ return T;
+ }
+}
+
+class A<U, V extends List> = Object with M<U, V, Map<U, V>> implements I<V>;
+
+class C<T, K> = S<Set<T>, T> with A<T, List<K>> implements J<K>;
+
+main() {
+ var c = new C<int, bool>();
+ Expect.equals("Map<int, List<bool>>", c.t().toString());
+ Expect.isTrue(c is I<List<bool>>);
+ Expect.isTrue(c is J<bool>);
+ Expect.isTrue(c is S<Set<int>, int>);
+ Expect.isTrue(c is A<int, List<bool>>);
+ Expect.isTrue(c is M<int, List<bool>, Map<int, List<bool>>>);
+}
diff --git a/tests/language/mixin_legacy/mixin_test.dart b/tests/language/mixin_legacy/mixin_test.dart
new file mode 100644
index 0000000..1240529
--- /dev/null
+++ b/tests/language/mixin_legacy/mixin_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class M1 {
+ foo() => 42;
+}
+
+class M2 = Object with M1;
+
+class S {}
+
+class C = S with M2;
+
+main() {
+ var c = new C();
+ Expect.isTrue(c is S);
+ Expect.isTrue(c is M1);
+ Expect.isTrue(c is M2);
+ Expect.isTrue(c is C);
+ Expect.equals(42, c.foo());
+}
diff --git a/tests/language/mixin_legacy/mixin_type_arguments_test.dart b/tests/language/mixin_legacy/mixin_type_arguments_test.dart
new file mode 100644
index 0000000..9698e2d
--- /dev/null
+++ b/tests/language/mixin_legacy/mixin_type_arguments_test.dart
@@ -0,0 +1,99 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import 'package:expect/expect.dart' show Expect;
+
+@pragma("vm:entry-point") // Prevent obfuscation
+class A {}
+
+@pragma("vm:entry-point") // Prevent obfuscation
+class B {}
+
+@pragma("vm:entry-point") // Prevent obfuscation
+class C {}
+
+@pragma("vm:entry-point") // Prevent obfuscation
+class D {}
+
+@pragma("vm:entry-point") // Prevent obfuscation
+class E {}
+
+@pragma("vm:entry-point") // Prevent obfuscation
+class F {}
+
+@pragma("vm:entry-point") // Prevent obfuscation
+class M1<Tm1> {
+ m1() => "M1<$Tm1>";
+}
+
+@pragma("vm:entry-point") // Prevent obfuscation
+class M2<Tm2> {
+ m2() => "M2<$Tm2>";
+}
+
+@pragma("vm:entry-point") // Prevent obfuscation
+class M3<Tm3> {
+ m3() => "M3<$Tm3>";
+}
+
+@pragma("vm:entry-point") // Prevent obfuscation
+class M4<Tm4> {
+ m4() => "M4<$Tm4>";
+}
+
+@pragma("vm:entry-point") // Prevent obfuscation
+class M5<Tm5> {
+ m5() => "M5<$Tm5>";
+}
+
+class C1 = Object with M1, M2<A>, M3, M4<B>, M5<C>;
+
+class C2 = Object with M1<A>, M2<B>, M3<C>, M4<D>, M5<E>;
+
+class C3<T> = Object with M1<A>, M2<T>, M3, M4, M5<B>;
+
+class C4 extends Object with M1, M2<A>, M3, M4<B>, M5<C> {}
+
+class C5 extends Object with M1<A>, M2<B>, M3<C>, M4<D>, M5<E> {}
+
+class C6<T> extends Object with M1<A>, M2<T>, M3, M4, M5<B> {}
+
+class C7 = Object with M1<A>, M2<A>, M3<A>, M4<A>, M5<A>;
+
+class C8 extends Object with M1<A>, M2<A>, M3<A>, M4<A>, M5<A> {}
+
+class C9 = Object
+ with M1<List<A>>, M2<List<A>>, M3<List<A>>, M4<List<A>>, M5<List<A>>;
+
+class CA extends Object
+ with M1<List<A>>, M2<List<A>>, M3<List<A>>, M4<List<A>>, M5<List<A>> {}
+
+trace(x) => "${x.m1()}, ${x.m2()}, ${x.m3()}, ${x.m4()}, ${x.m5()}";
+
+main() {
+ Expect.stringEquals(
+ "M1<dynamic>, M2<A>, M3<dynamic>, M4<B>, M5<C>", trace(new C1()));
+ Expect.stringEquals("M1<A>, M2<B>, M3<C>, M4<D>, M5<E>", trace(new C2()));
+ Expect.stringEquals(
+ "M1<A>, M2<dynamic>, M3<dynamic>, M4<dynamic>, M5<B>", trace(new C3()));
+ Expect.stringEquals(
+ "M1<A>, M2<F>, M3<dynamic>, M4<dynamic>, M5<B>", trace(new C3<F>()));
+ Expect.stringEquals(
+ "M1<dynamic>, M2<A>, M3<dynamic>, M4<B>, M5<C>", trace(new C4()));
+ Expect.stringEquals("M1<A>, M2<B>, M3<C>, M4<D>, M5<E>", trace(new C5()));
+ Expect.stringEquals(
+ "M1<A>, M2<dynamic>, M3<dynamic>, M4<dynamic>, M5<B>", trace(new C6()));
+ Expect.stringEquals(
+ "M1<A>, M2<F>, M3<dynamic>, M4<dynamic>, M5<B>", trace(new C6<F>()));
+ Expect.stringEquals("M1<A>, M2<A>, M3<A>, M4<A>, M5<A>", trace(new C7()));
+ Expect.stringEquals("M1<A>, M2<A>, M3<A>, M4<A>, M5<A>", trace(new C8()));
+ Expect.stringEquals(
+ "M1<List<A>>, M2<List<A>>, M3<List<A>>, M4<List<A>>, M5<List<A>>",
+ trace(new C9()));
+ Expect.stringEquals(
+ "M1<List<A>>, M2<List<A>>, M3<List<A>>, M4<List<A>>, M5<List<A>>",
+ trace(new CA()));
+}
diff --git a/tests/language/mixin_legacy/named_constructor_test.dart b/tests/language/mixin_legacy/named_constructor_test.dart
new file mode 100644
index 0000000..5a29c9c
--- /dev/null
+++ b/tests/language/mixin_legacy/named_constructor_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+var calls = <String>[];
+
+abstract class A {
+ bool _done = true;
+ var a = calls.add('A()') as dynamic;
+}
+
+abstract class B {
+ B.protected() {
+ calls.add('B.protected()');
+ }
+}
+
+class C extends B with A {
+ C() : super.protected() {
+ calls.add('C()');
+ }
+}
+
+void main() {
+ var c = new C();
+ Expect.isTrue(c._done);
+ Expect.equals(calls.join(', '), 'A(), B.protected(), C()');
+}
diff --git a/tests/language/mixin_legacy/naming_test.dart b/tests/language/mixin_legacy/naming_test.dart
new file mode 100644
index 0000000..a5d6301
--- /dev/null
+++ b/tests/language/mixin_legacy/naming_test.dart
@@ -0,0 +1,53 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S {}
+
+class M1 {}
+
+class M2 {}
+
+class M3 {}
+
+class C = S with M1, M2, M3;
+
+class D extends S with M1, M2, M3 {}
+
+class S_M1 {}
+
+class S_M1_M2 {}
+
+main() {
+ var c = new C();
+ Expect.isTrue(c is C);
+ Expect.isFalse(c is D);
+ Expect.isTrue(c is S);
+ Expect.isFalse(c is S_M1);
+ Expect.isFalse(c is S_M1_M2);
+
+ var d = new D();
+ Expect.isFalse(d is C);
+ Expect.isTrue(d is D);
+ Expect.isTrue(d is S);
+ Expect.isFalse(d is S_M1);
+ Expect.isFalse(d is S_M1_M2);
+
+ var sm = new S_M1();
+ Expect.isFalse(sm is C);
+ Expect.isFalse(sm is D);
+ Expect.isFalse(sm is S);
+ Expect.isTrue(sm is S_M1);
+ Expect.isFalse(sm is S_M1_M2);
+
+ var smm = new S_M1_M2();
+ Expect.isFalse(smm is C);
+ Expect.isFalse(smm is D);
+ Expect.isFalse(smm is S);
+ Expect.isFalse(smm is S_M1);
+ Expect.isTrue(smm is S_M1_M2);
+}
diff --git a/tests/language/mixin_legacy/only_for_rti_test.dart b/tests/language/mixin_legacy/only_for_rti_test.dart
new file mode 100644
index 0000000..dbe1302
--- /dev/null
+++ b/tests/language/mixin_legacy/only_for_rti_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class Tester<T> {
+ testGenericType(x) {
+ return x is T;
+ }
+}
+
+abstract class A = B with C;
+
+class B {}
+
+class C {}
+
+class X extends Y with Z {}
+
+class Y {}
+
+class Z {}
+
+main() {
+ // Classes A and X are only used as generic arguments.
+ Expect.isFalse(new Tester<A>().testGenericType(new Object()));
+ Expect.isFalse(new Tester<X>().testGenericType(new Object()));
+}
diff --git a/tests/language/mixin_legacy/override_regression_test.dart b/tests/language/mixin_legacy/override_regression_test.dart
new file mode 100644
index 0000000..b266da7
--- /dev/null
+++ b/tests/language/mixin_legacy/override_regression_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class C0 {
+ int m1() => 5;
+ int m2() => m1();
+}
+
+class C1 = Object with C0;
+
+class D {
+ int m1() => 7;
+}
+
+class E0 extends C0 with D {}
+
+class E1 extends C1 with D {}
+
+main() {
+ Expect.equals(7, new E0().m2());
+ Expect.equals(7, new E1().m2());
+}
diff --git a/tests/language/mixin_legacy/prefix_lib.dart b/tests/language/mixin_legacy/prefix_lib.dart
new file mode 100644
index 0000000..2df87a8
--- /dev/null
+++ b/tests/language/mixin_legacy/prefix_lib.dart
@@ -0,0 +1,13 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+library mixin_prefix_lib;
+
+import "dart:convert";
+
+mixin MixinClass {
+ String bar() => json.encode({'a': 1});
+}
diff --git a/tests/language/mixin_legacy/prefix_test.dart b/tests/language/mixin_legacy/prefix_test.dart
new file mode 100644
index 0000000..024739d
--- /dev/null
+++ b/tests/language/mixin_legacy/prefix_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Regression test for issue 11891.
+
+import "package:expect/expect.dart";
+import "prefix_lib.dart";
+
+class A extends Object with MixinClass {
+ String baz() => bar();
+}
+
+void main() {
+ var a = new A();
+ Expect.equals('{"a":1}', a.baz());
+}
diff --git a/tests/language/mixin_legacy/proto_test.dart b/tests/language/mixin_legacy/proto_test.dart
new file mode 100644
index 0000000..691ff64
--- /dev/null
+++ b/tests/language/mixin_legacy/proto_test.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Tests that a program in csp mode doesn't access the prototype chain
+// on platforms that don't support direct access to __proto__.
+// This test is most useful with --csp and on a platform that doesn't support
+// __proto__ access (such as Rhino).
+// See http://dartbug.com/27290 .
+
+import 'package:expect/expect.dart';
+
+class A {
+ var x;
+ foo() => 44;
+ bar() => 22;
+}
+
+class B {
+ var y;
+ foo() => 42;
+}
+
+class C extends A with B {
+ var z;
+ bar() => 499;
+}
+
+@pragma('dart2js:noInline')
+@pragma('dart2js:assumeDynamic')
+confuse(x) => x;
+
+main() {
+ var all = [new A(), new B(), new C()];
+ Expect.equals(44, confuse(all[0]).foo());
+ Expect.equals(22, confuse(all[0]).bar());
+ Expect.equals(42, confuse(all[1]).foo());
+ Expect.equals(42, confuse(all[2]).foo());
+ Expect.equals(499, confuse(all[2]).bar());
+}
diff --git a/tests/language/mixin_legacy/recursive_mixin_test.dart b/tests/language/mixin_legacy/recursive_mixin_test.dart
new file mode 100644
index 0000000..771e154
--- /dev/null
+++ b/tests/language/mixin_legacy/recursive_mixin_test.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class A<T> {
+ bool foo(T x) => true;
+}
+
+class B extends Object with A<B>, C<B> {}
+
+// Tests #31290
+class C<T> {}
+
+main() {
+ var b = new B();
+ Expect.isTrue(b is B);
+ Expect.isTrue(b is A);
+ Expect.isTrue(b is C);
+
+ // Verify that runtime checking enforces A<B> instead of A
+ dynamic d = b;
+ Expect.isTrue(d.foo(b));
+ Expect.throws(() => d.foo(42));
+}
diff --git a/tests/language/mixin_legacy/regress_11398_test.dart b/tests/language/mixin_legacy/regress_11398_test.dart
new file mode 100644
index 0000000..fe11e62
--- /dev/null
+++ b/tests/language/mixin_legacy/regress_11398_test.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+void main() {
+ var hva = new HasValueA();
+ hva.value = '42';
+ Expect.equals('42', hva.value);
+
+ var hvb = new HasValueB();
+ hvb.value = '87';
+ Expect.equals('87', hvb.value);
+
+ var hvc = new HasValueC();
+ hvc.value = '99';
+ Expect.equals('99', hvc.value);
+}
+
+abstract class Delegate {
+ String invoke(String value);
+}
+
+abstract class DelegateMixin {
+ String invoke(String value) => value;
+}
+
+abstract class HasValueMixin implements Delegate {
+ String _value = '';
+ set value(String value) {
+ _value = invoke(value);
+ }
+
+ String get value => _value;
+}
+
+class HasValueA extends Object with HasValueMixin, DelegateMixin {}
+
+class HasValueB extends Object with DelegateMixin, HasValueMixin {}
+
+class HasValueC extends Object with HasValueMixin {
+ String invoke(String value) => value;
+}
diff --git a/tests/language/mixin_legacy/regress_13688_test.dart b/tests/language/mixin_legacy/regress_13688_test.dart
new file mode 100644
index 0000000..ed12af4
--- /dev/null
+++ b/tests/language/mixin_legacy/regress_13688_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class ComparableMixin<E> {
+ e() {
+ return E;
+ }
+}
+
+class KUID extends Object with ComparableMixin<KUID> {}
+
+main() {
+ var kuid = new KUID();
+ Expect.equals(kuid.runtimeType.toString(), kuid.e().toString());
+}
diff --git a/tests/language/mixin_legacy/regress_47645_test.dart b/tests/language/mixin_legacy/regress_47645_test.dart
new file mode 100644
index 0000000..28a9914
--- /dev/null
+++ b/tests/language/mixin_legacy/regress_47645_test.dart
@@ -0,0 +1,21 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+// Regression test for https://github.com/dart-lang/sdk/issues/47645.
+// To reproduce the issue the class declaration must appear before the mixin
+// declaration.
+class C<T> with M<C<T>> {}
+
+mixin M<T> {
+ bool fn() => true;
+}
+
+void main() {
+ var c = C<int>();
+ Expect.isTrue(c.fn());
+}
diff --git a/tests/language/mixin_legacy/regress_flutter_55345_const_test.dart b/tests/language/mixin_legacy/regress_flutter_55345_const_test.dart
new file mode 100644
index 0000000..b98a474
--- /dev/null
+++ b/tests/language/mixin_legacy/regress_flutter_55345_const_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Verifies that references to deduplicated mixins are properly updated
+// in types which are only accessible through constants.
+// Regression test for https://github.com/flutter/flutter/issues/55345.
+
+class Diagnosticable {}
+
+class SomeClass with Diagnosticable {}
+
+class State<T> with Diagnosticable {
+ const State();
+}
+
+class StateA extends State {
+ const StateA();
+}
+
+class StateB extends State<int> {
+ const StateB();
+}
+
+const c1 = StateA() as dynamic;
+const c2 = StateB();
+
+main() {
+ print(const [
+ {
+ (c1 ?? c2): [
+ [c1 ?? c2]
+ ]
+ },
+ 'abc'
+ ]);
+ // No compile time or runtime errors.
+}
diff --git a/tests/language/mixin_legacy/regress_flutter_55345_test.dart b/tests/language/mixin_legacy/regress_flutter_55345_test.dart
new file mode 100644
index 0000000..da142e1
--- /dev/null
+++ b/tests/language/mixin_legacy/regress_flutter_55345_test.dart
@@ -0,0 +1,44 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Verifies that references to deduplicated mixins are properly updated.
+// Regression test for https://github.com/flutter/flutter/issues/55345.
+
+class Diagnosticable {}
+
+class SomeClass with Diagnosticable {}
+
+class State<T> with Diagnosticable {}
+
+class StateA extends State {}
+
+class StateB extends State<int> {}
+
+StateA? a = StateA();
+StateB? b = StateB();
+
+List<T> foo<T>(T x) {
+ print(T);
+ return <T>[x];
+}
+
+T Function<S extends T>(T) bar<T>(T x) {
+ print(T);
+
+ return <S extends T>(T y) {
+ print(S);
+ print(y);
+ return y;
+ };
+}
+
+main() {
+ var x2 = a ?? b;
+ var x3 = foo(x2);
+ var x4 = bar(x3);
+ x4(x3);
+ // No compile time or runtime errors.
+}
diff --git a/tests/language/mixin_legacy/regress_flutter_66859_1_test.dart b/tests/language/mixin_legacy/regress_flutter_66859_1_test.dart
new file mode 100644
index 0000000..abebd94
--- /dev/null
+++ b/tests/language/mixin_legacy/regress_flutter_66859_1_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Verifies that mixin supertypes are properly maintained even if marked as
+// deferred (e.g., in a circular hierarchy).
+// Regression test for: https://github.com/flutter/flutter/issues/66859
+
+import "package:expect/expect.dart";
+
+mixin M {}
+
+mixin N {}
+
+class A extends B<C> with M, N {}
+
+class B<T> {}
+
+class C extends A {}
+
+class Z extends B<Z> with M {}
+
+main() {
+ var z = Z();
+ Expect.isTrue(z is B<Z>);
+ Expect.isTrue(z is M);
+ var a = A();
+ Expect.isTrue(a is M);
+ Expect.isTrue(a is N);
+ Expect.isTrue(a is B<C>);
+}
diff --git a/tests/language/mixin_legacy/regress_flutter_66859_2_test.dart b/tests/language/mixin_legacy/regress_flutter_66859_2_test.dart
new file mode 100644
index 0000000..1b6c09d
--- /dev/null
+++ b/tests/language/mixin_legacy/regress_flutter_66859_2_test.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Verifies that mixin supertypes are properly maintained even if marked as
+// deferred (e.g., in a circular hierarchy).
+// Regression test for: https://github.com/flutter/flutter/issues/66859
+
+import "package:expect/expect.dart";
+
+mixin X {}
+mixin Y {}
+mixin Z {}
+
+class A extends B<C> with X {}
+
+class C extends A with Z {}
+
+class B<T> extends Object with Y {}
+
+main() {
+ var a = A();
+ var b = B();
+ var c = C();
+ Expect.isTrue(a is A);
+ Expect.isTrue(a is B<C>);
+ Expect.isTrue(a is X);
+ Expect.isTrue(a is Y);
+ Expect.isTrue(c is C);
+ Expect.isTrue(c is A);
+ Expect.isTrue(c is B<C>);
+ Expect.isTrue(c is X);
+ Expect.isTrue(c is Y);
+ Expect.isTrue(c is Z);
+ Expect.isTrue(b is B);
+ Expect.isTrue(b is Y);
+}
diff --git a/tests/language/mixin_legacy/substitution_test.dart b/tests/language/mixin_legacy/substitution_test.dart
new file mode 100644
index 0000000..8bba890
--- /dev/null
+++ b/tests/language/mixin_legacy/substitution_test.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Test that mixins don't interfere with type variable substitution.
+
+import '../dynamic_type_helper.dart';
+
+class B<T> {
+ B(T x);
+}
+
+class M {}
+
+class A<T> extends B<T> with M {
+ A(T x) : super(x); // This line must be warning free.
+}
+
+class C<T> = B<T> with M;
+
+main() {
+ new A(null);
+ new C<String>('');
+ dynamic value = 0;
+ checkDynamicTypeError(() => new C<String>(value));
+}
diff --git a/tests/language/mixin_legacy/super_2_test.dart b/tests/language/mixin_legacy/super_2_test.dart
new file mode 100644
index 0000000..a3a1b6c
--- /dev/null
+++ b/tests/language/mixin_legacy/super_2_test.dart
@@ -0,0 +1,43 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class B {
+ // 'super' resolves to Object, and in some tests, multiple points in the
+ // inheritance chain.
+ toString() => 'B(' + super.toString() + ')';
+}
+
+class R {
+ toString() => 'R[' + super.toString() + ']';
+}
+
+class D extends R with B {
+ toString() => 'D<' + super.toString() + '>';
+}
+
+class E extends D with B {
+ toString() => 'E{' + super.toString() + '}';
+}
+
+class F = R with B, B;
+
+class G extends F with B {
+ toString() => 'G{' + super.toString() + '}';
+}
+
+main() {
+ check(object, String expected) {
+ Expect.equals(expected, object.toString());
+ }
+
+ check(B(), "B(Instance of '$B')");
+ check(R(), "R[Instance of '$R']");
+ check(D(), "D<B(R[Instance of '$D'])>");
+ check(E(), "E{B(D<B(R[Instance of '$E'])>)}");
+ check(G(), "G{B(B(B(R[Instance of '$G'])))}");
+}
diff --git a/tests/language/mixin_legacy/super_bound_runtime_test.dart b/tests/language/mixin_legacy/super_bound_runtime_test.dart
new file mode 100644
index 0000000..c6ee274
--- /dev/null
+++ b/tests/language/mixin_legacy/super_bound_runtime_test.dart
@@ -0,0 +1,30 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class M<U extends V, V> {}
+
+class N<U, V extends U> {}
+
+class S<T> {}
+
+class MNA<U, V extends U, W> extends S<List<U>>
+ with M<V, U>, N<List<W>, List<W>> {}
+
+class MNA2<U, V extends U, W> = S<List<U>> with M<V, U>, N<List<W>, List<W>>;
+
+main() {
+ new MNA<num, int, bool>();
+ new MNA2<num, int, bool>();
+
+ // Type parameter U of M must extend type parameter V, but
+ // type argument num is not a subtype of int.
+
+ // Type parameter U of M must extend type parameter V, but
+ // type argument num is not a subtype of int.
+}
diff --git a/tests/language/mixin_legacy/super_bound_test.dart b/tests/language/mixin_legacy/super_bound_test.dart
new file mode 100644
index 0000000..cb8b773
--- /dev/null
+++ b/tests/language/mixin_legacy/super_bound_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class M<U extends V, V> {}
+
+class N<U, V extends U> {}
+
+class S<T> {}
+
+class MNA<U, V extends U, W> extends S<List<U>>
+ with M<V, U>, N<List<W>, List<W>> {}
+
+class MNA2<U, V extends U, W> = S<List<U>> with M<V, U>, N<List<W>, List<W>>;
+
+main() {
+ new MNA<num, int, bool>();
+ new MNA2<num, int, bool>();
+
+ // Type parameter U of M must extend type parameter V, but
+ // type argument num is not a subtype of int.
+ new MNA<int, num, bool>();
+ // ^
+ // [cfe] Type argument 'num' doesn't conform to the bound 'U' of the type variable 'V' on 'MNA'.
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
+
+ // Type parameter U of M must extend type parameter V, but
+ // type argument num is not a subtype of int.
+ new MNA2<int, num, bool>();
+ // ^
+ // [cfe] Type argument 'num' doesn't conform to the bound 'U' of the type variable 'V' on 'MNA2'.
+ // ^^^
+ // [analyzer] COMPILE_TIME_ERROR.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
+}
diff --git a/tests/language/mixin_legacy/super_constructor2_test.dart b/tests/language/mixin_legacy/super_constructor2_test.dart
new file mode 100644
index 0000000..dcbe5d5
--- /dev/null
+++ b/tests/language/mixin_legacy/super_constructor2_test.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class Base {
+ var i, j;
+ Base.ctor1(int i, this.j) : this.i = i + 7;
+ Base.ctor2(int i, this.j) : this.i = i + 8;
+}
+
+abstract class M {
+ get i;
+ get j;
+ int k = 42;
+ foo() => i + j;
+}
+
+class C extends Base with M {
+ int l = 131;
+ C.ctor1() : super.ctor1(1, 13);
+ C.ctor2() : super.ctor2(1, 13);
+}
+
+main() {
+ C c1 = new C.ctor1();
+ Expect.equals(8, c1.i);
+ Expect.equals(13, c1.j);
+ Expect.equals(42, c1.k);
+ Expect.equals(131, c1.l);
+ Expect.equals(21, c1.foo());
+ C c2 = new C.ctor2();
+ Expect.equals(9, c2.i);
+ Expect.equals(13, c2.j);
+ Expect.equals(42, c2.k);
+ Expect.equals(131, c2.l);
+ Expect.equals(22, c2.foo());
+}
diff --git a/tests/language/mixin_legacy/super_constructor_default_test.dart b/tests/language/mixin_legacy/super_constructor_default_test.dart
new file mode 100644
index 0000000..d0b4ce3
--- /dev/null
+++ b/tests/language/mixin_legacy/super_constructor_default_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class Base {
+ int i, j;
+ Base(int i, this.j) : this.i = i + 7;
+}
+
+abstract class M {
+ int get i;
+ int get j;
+ int k = 42;
+ foo() => i + j;
+}
+
+class C extends Base with M {
+ int l = 131;
+ C() : super(1, 13);
+}
+
+main() {
+ C c = new C();
+ Expect.equals(8, c.i);
+ Expect.equals(13, c.j);
+ Expect.equals(21, c.foo());
+ Expect.equals(42, c.k);
+ Expect.equals(131, c.l);
+}
diff --git a/tests/language/mixin_legacy/super_constructor_multiple_test.dart b/tests/language/mixin_legacy/super_constructor_multiple_test.dart
new file mode 100644
index 0000000..ec55380
--- /dev/null
+++ b/tests/language/mixin_legacy/super_constructor_multiple_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S {
+ int i;
+ S.foo() : i = 1742;
+}
+
+class M1 {}
+
+class M2 {}
+
+class C extends S with M1, M2 {
+ C.foo() : super.foo();
+}
+
+main() {
+ Expect.equals(1742, new C.foo().i);
+}
diff --git a/tests/language/mixin_legacy/super_constructor_named_test.dart b/tests/language/mixin_legacy/super_constructor_named_test.dart
new file mode 100644
index 0000000..a70aeb6
--- /dev/null
+++ b/tests/language/mixin_legacy/super_constructor_named_test.dart
@@ -0,0 +1,41 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class Base {
+ int? i, j;
+ Base.ctor(int? this.i
+ , {int? this.j = 10} // //# 01: ok
+ ) {
+ if (j == null) {
+ j = 10;
+ }
+ }
+}
+
+abstract class M {
+ int? get i;
+ int? get j;
+ int k = 42;
+ foo() => i! + j!;
+}
+
+class C extends Base with M {
+ int l = 131;
+ C.foo() : super.ctor(1, j: 13); //# 01: continued
+ C.bar() : super.ctor(1);
+}
+
+main() {
+ C c1 = new C.foo(); // //# 01: continued
+ C c2 = new C.bar();
+ Expect.equals(1, c2.i);
+ Expect.equals(10, c2.j);
+ Expect.equals(11, c2.foo());
+ Expect.equals(42, c2.k);
+ Expect.equals(131, c2.l);
+}
diff --git a/tests/language/mixin_legacy/super_constructor_positionals_test.dart b/tests/language/mixin_legacy/super_constructor_positionals_test.dart
new file mode 100644
index 0000000..422d41f
--- /dev/null
+++ b/tests/language/mixin_legacy/super_constructor_positionals_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class Base {
+ int? i, j;
+ Base.ctor(
+ int? this.i,
+ [ // //# 01: ok
+ int? this.j
+ ] // //# 01: continued
+ );
+}
+
+abstract class M {
+ int? get i;
+ int? get j;
+ int k = 42;
+ foo() => i! + j!;
+}
+
+class C extends Base with M {
+ int l = 131;
+ C.foo() : super.ctor(1, 13);
+ C.bar() : super.ctor(1); // //# 01: continued
+}
+
+main() {
+ C c1 = new C.foo();
+ Expect.equals(1, c1.i);
+ Expect.equals(13, c1.j);
+ Expect.equals(14, c1.foo());
+ Expect.equals(42, c1.k);
+ Expect.equals(131, c1.l);
+ C c2 = new C.bar(); // //# 01: continued
+}
diff --git a/tests/language/mixin_legacy/super_constructor_test.dart b/tests/language/mixin_legacy/super_constructor_test.dart
new file mode 100644
index 0000000..23cc3e8
--- /dev/null
+++ b/tests/language/mixin_legacy/super_constructor_test.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class Base {
+ int i, j;
+ Base.ctor(int i, this.j) : this.i = i + 7;
+}
+
+abstract class M {
+ int get i;
+ int get j;
+ int k = 42;
+ foo() => i + j;
+}
+
+class C extends Base with M {
+ int l = 131;
+ C() : super.ctor(1, 13);
+}
+
+main() {
+ C c = new C();
+ Expect.equals(8, c.i);
+ Expect.equals(13, c.j);
+ Expect.equals(42, c.k);
+ Expect.equals(131, c.l);
+ Expect.equals(21, c.foo());
+}
diff --git a/tests/language/mixin_legacy/super_test.dart b/tests/language/mixin_legacy/super_test.dart
new file mode 100644
index 0000000..cec0844
--- /dev/null
+++ b/tests/language/mixin_legacy/super_test.dart
@@ -0,0 +1,106 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class MS<T> {
+ foo() {
+ return "MS<$T>.foo\n";
+ }
+}
+
+mixin M<T> on MS<List<T>> {
+ foo() {
+ return super.foo() + "M<$T>.foo\n";
+ }
+}
+
+class NS<T> {
+ foo() {
+ return "NS<$T>.foo\n";
+ }
+}
+
+mixin N<T> on NS<List<T>> {
+ foo() {
+ return super.foo() + "N<$T>.foo\n";
+ }
+}
+
+class S<T, V, W> implements MS<List<V>>, NS<List<W>> {
+ foo() {
+ return "S<$T,$V,$W>.foo\n";
+ }
+}
+
+class SM<U, V, W> = S<U, V, W> with M<V>;
+
+class MNA1<U, V, W> extends S<U, V, W> with M<V>, N<W> {
+ foo() {
+ return super.foo() + "MNA1<$U, $V, $W>.foo\n";
+ }
+}
+
+class MNA2<U, V, W> extends SM<U, V, W> with N<W> {
+ foo() {
+ return super.foo() + "MNA2<$U, $V, $W>.foo\n";
+ }
+}
+
+class MNA3<U, V, W> extends S<U, V, W> with M<V>, N<W> {
+ foo() {
+ return super.foo() + "MNA3<$U, $V, $W>.foo\n";
+ }
+}
+
+abstract class Base {
+ static String log = '';
+ Base() {
+ log += 'Base()\n';
+ }
+}
+
+mixin Foo on Base {
+ var x = Base.log += 'Foo.x\n';
+}
+
+mixin Bar on Base {
+ var y = Base.log += 'Bar.y\n';
+}
+
+class Derived extends Base with Foo, Bar {
+ String get log => Base.log;
+}
+
+main() {
+ Expect.equals(
+ "S<int,String,bool>.foo\n"
+ "M<String>.foo\n",
+ SM<int, String, bool>().foo());
+ Expect.equals(
+ "S<int,String,bool>.foo\n"
+ "M<String>.foo\n"
+ "N<bool>.foo\n"
+ "MNA1<int, String, bool>.foo\n",
+ MNA1<int, String, bool>().foo());
+ Expect.equals(
+ "S<int,String,bool>.foo\n"
+ "M<String>.foo\n"
+ "N<bool>.foo\n"
+ "MNA2<int, String, bool>.foo\n",
+ MNA2<int, String, bool>().foo());
+ Expect.equals(
+ "S<int,String,bool>.foo\n"
+ "M<String>.foo\n"
+ "N<bool>.foo\n"
+ "MNA3<int, String, bool>.foo\n",
+ MNA3<int, String, bool>().foo());
+ Expect.equals(
+ "Bar.y\n"
+ "Foo.x\n"
+ "Base()\n",
+ Derived().log);
+}
diff --git a/tests/language/mixin_legacy/super_use_test.dart b/tests/language/mixin_legacy/super_use_test.dart
new file mode 100644
index 0000000..51e89f2
--- /dev/null
+++ b/tests/language/mixin_legacy/super_use_test.dart
@@ -0,0 +1,67 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class M {}
+
+class P0 {
+ foo() {
+ super.toString();
+
+ void inner() {
+ super.toString();
+ }
+
+ inner();
+
+ (() {
+ super.toString();
+ })();
+
+ return 42;
+ }
+}
+
+class P1 {
+ bar() {
+ super.toString();
+ return 87;
+ }
+
+ // The test method is strategically placed here to try to force the
+ // P1 class and its bar method to be resolved before resolving the
+ // mixin applications.
+ test() {
+ new C();
+ var d = new D();
+ var e = new E();
+ var f = new F();
+ Expect.equals(42, d.foo());
+ Expect.equals(87, e.bar());
+ Expect.equals(99, f.baz());
+ }
+}
+
+class P2 {
+ baz() {
+ super.toString();
+ return 99;
+ }
+}
+
+class C = Object with M;
+class D = Object with P0;
+class E = Object with M, P1;
+class F = Object with P2, M;
+
+main() {
+ var p1 = new P1();
+ var p2 = new P2();
+ Expect.equals(87, p1.bar());
+ p1.test();
+ Expect.equals(99, p2.baz());
+}
diff --git a/tests/language/mixin_legacy/super_with_initializer_test.dart b/tests/language/mixin_legacy/super_with_initializer_test.dart
new file mode 100644
index 0000000..107033d
--- /dev/null
+++ b/tests/language/mixin_legacy/super_with_initializer_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+/// Regression test for mixin overrides (dartbug.com/44636).
+///
+/// Prior to the fix, B's initializer was accidentally being applied on the
+/// overridden definition in C, and as a result, the program would stack
+/// overflow.
+import 'package:expect/expect.dart';
+
+class A = B with C;
+
+mixin M {}
+
+abstract class B with M {
+ Object _test = "a";
+}
+
+mixin C on B, M {
+ @override
+ Object get _test => super._test;
+
+ @override
+ set _test(Object value) {
+ super._test = value;
+ }
+}
+
+main() => Expect.equals("a", A()._test);
diff --git a/tests/language/mixin_legacy/superclass_runtime_test.dart b/tests/language/mixin_legacy/superclass_runtime_test.dart
new file mode 100644
index 0000000..8f1f17f
--- /dev/null
+++ b/tests/language/mixin_legacy/superclass_runtime_test.dart
@@ -0,0 +1,94 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class S0 {}
+
+class S1 extends Object {}
+
+class S2 extends S0 {}
+
+class M0 {}
+
+class M1 extends Object {}
+
+mixin M2 on M0 {}
+
+class C00 = S0 with M0;
+class C01 = S0 with M1;
+
+class C03 = S0 with M0, M1;
+class C04 = S0 with M0, M2;
+
+class C10 = S1 with M0;
+class C11 = S1 with M1;
+
+class C13 = S1 with M0, M1;
+class C14 = S1 with M0, M2;
+
+class C20 = S2 with M0;
+class C21 = S2 with M1;
+
+class C23 = S2 with M0, M1;
+class C24 = S2 with M0, M2;
+
+class D00 extends S0 with M0 {}
+
+class D01 extends S0 with M1 {}
+
+class D03 extends S0 with M0, M1 {}
+
+class D04 extends S0 with M0, M2 {}
+
+class D10 extends S1 with M0 {}
+
+class D11 extends S1 with M1 {}
+
+class D13 extends S1 with M0, M1 {}
+
+class D14 extends S1 with M0, M2 {}
+
+class D20 extends S2 with M0 {}
+
+class D21 extends S2 with M1 {}
+
+class D23 extends S2 with M0, M1 {}
+
+class D24 extends S2 with M0, M2 {}
+
+main() {
+ new C00();
+ new C01();
+ new C03();
+ new C04();
+
+ new C10();
+ new C11();
+ new C13();
+ new C14();
+
+ new C20();
+ new C21();
+ new C23();
+ new C24();
+
+ new D00();
+ new D01();
+ new D03();
+ new D04();
+
+ new D10();
+ new D11();
+ new D13();
+ new D14();
+
+ new D20();
+ new D21();
+ new D23();
+ new D24();
+}
diff --git a/tests/language/mixin_legacy/superclass_test.dart b/tests/language/mixin_legacy/superclass_test.dart
new file mode 100644
index 0000000..d4ac492
--- /dev/null
+++ b/tests/language/mixin_legacy/superclass_test.dart
@@ -0,0 +1,220 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class S0 {}
+
+class S1 extends Object {}
+
+class S2 extends S0 {}
+
+class M0 {}
+
+class M1 extends Object {}
+
+mixin M2 on M0 {}
+
+class C00 = S0 with M0;
+class C01 = S0 with M1;
+class C02 = S0 with M2;
+// ^
+// [cfe] 'S0' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+class C03 = S0 with M0, M1;
+class C04 = S0 with M0, M2;
+class C05 = S0 with M2, M0;
+// ^
+// [cfe] 'S0' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+class C06 = S0 with M1, M2;
+// ^
+// [cfe] '_C06&S0&M1' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+class C07 = S0 with M2, M1;
+// ^
+// [cfe] 'S0' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class C10 = S1 with M0;
+class C11 = S1 with M1;
+class C12 = S1 with M2;
+// ^
+// [cfe] 'S1' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+class C13 = S1 with M0, M1;
+class C14 = S1 with M0, M2;
+class C15 = S1 with M2, M0;
+// ^
+// [cfe] 'S1' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+class C16 = S1 with M1, M2;
+// ^
+// [cfe] '_C16&S1&M1' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+class C17 = S1 with M2, M1;
+// ^
+// [cfe] 'S1' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class C20 = S2 with M0;
+class C21 = S2 with M1;
+class C22 = S2 with M2;
+// ^
+// [cfe] 'S2' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+class C23 = S2 with M0, M1;
+class C24 = S2 with M0, M2;
+class C25 = S2 with M2, M0;
+// ^
+// [cfe] 'S2' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+class C26 = S2 with M1, M2;
+// ^
+// [cfe] '_C26&S2&M1' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+class C27 = S2 with M2, M1;
+// ^
+// [cfe] 'S2' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class D00 extends S0 with M0 {}
+
+class D01 extends S0 with M1 {}
+
+class D02 extends S0 with M2 {}
+// ^
+// [cfe] 'S0' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class D03 extends S0 with M0, M1 {}
+
+class D04 extends S0 with M0, M2 {}
+
+class D05 extends S0 with M2, M0 {}
+// ^
+// [cfe] 'S0' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class D06 extends S0 with M1, M2 {}
+// ^
+// [cfe] '_D06&S0&M1' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class D07 extends S0 with M2, M1 {}
+// ^
+// [cfe] 'S0' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class D10 extends S1 with M0 {}
+
+class D11 extends S1 with M1 {}
+
+class D12 extends S1 with M2 {}
+// ^
+// [cfe] 'S1' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class D13 extends S1 with M0, M1 {}
+
+class D14 extends S1 with M0, M2 {}
+
+class D15 extends S1 with M2, M0 {}
+// ^
+// [cfe] 'S1' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class D16 extends S1 with M1, M2 {}
+// ^
+// [cfe] '_D16&S1&M1' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class D17 extends S1 with M2, M1 {}
+// ^
+// [cfe] 'S1' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class D20 extends S2 with M0 {}
+
+class D21 extends S2 with M1 {}
+
+class D22 extends S2 with M2 {}
+// ^
+// [cfe] 'S2' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class D23 extends S2 with M0, M1 {}
+
+class D24 extends S2 with M0, M2 {}
+
+class D25 extends S2 with M2, M0 {}
+// ^
+// [cfe] 'S2' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class D26 extends S2 with M1, M2 {}
+// ^
+// [cfe] '_D26&S2&M1' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+class D27 extends S2 with M2, M1 {}
+// ^
+// [cfe] 'S2' doesn't implement 'M0' so it can't be used with 'M2'.
+// ^^
+// [analyzer] COMPILE_TIME_ERROR.MIXIN_APPLICATION_NOT_IMPLEMENTED_INTERFACE
+
+main() {
+ new C00();
+ new C01();
+ new C03();
+ new C04();
+
+ new C10();
+ new C11();
+ new C13();
+ new C14();
+
+ new C20();
+ new C21();
+ new C23();
+ new C24();
+
+ new D00();
+ new D01();
+ new D03();
+ new D04();
+
+ new D10();
+ new D11();
+ new D13();
+ new D14();
+
+ new D20();
+ new D21();
+ new D23();
+ new D24();
+}
diff --git a/tests/language/mixin_legacy/supertype_subclass2_test.dart b/tests/language/mixin_legacy/supertype_subclass2_test.dart
new file mode 100644
index 0000000..cfee7c2
--- /dev/null
+++ b/tests/language/mixin_legacy/supertype_subclass2_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class B {}
+
+class C {}
+
+class D {}
+
+class E extends B with C implements D {}
+
+class F extends E {}
+
+// M is mixed onto E which implements B, C and D.
+mixin M //
+ on B //# 01: ok
+ on C //# 02: ok
+ on D //# 03: ok
+ on E //# 04: ok
+ on F //# 05: compile-time error
+{}
+
+class A extends E with M {}
+
+main() {
+ new A();
+}
diff --git a/tests/language/mixin_legacy/supertype_subclass_test.dart b/tests/language/mixin_legacy/supertype_subclass_test.dart
new file mode 100644
index 0000000..eadf8bc
--- /dev/null
+++ b/tests/language/mixin_legacy/supertype_subclass_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class B {}
+
+class C {}
+
+class D {}
+
+class E extends B with C implements D {}
+
+class F extends E {}
+
+// M is mixed onto E which implements B, C and D.
+mixin M //
+ on B //# 01: ok
+ on C //# 02: ok
+ on D //# 03: ok
+ on E //# 04: ok
+ on F //# 05: compile-time error
+{}
+
+class A = E with M;
+
+main() {
+ new A();
+}
diff --git a/tests/language/mixin_legacy/this_use_test.dart b/tests/language/mixin_legacy/this_use_test.dart
new file mode 100644
index 0000000..31ebf44
--- /dev/null
+++ b/tests/language/mixin_legacy/this_use_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Test that [:this:] in a class A used as a mixin in class D knows it can be an
+// instance of D.
+
+import "package:expect/expect.dart";
+
+class A {
+ foo() => bar(); // Implicit use of [:this:]
+ bar() => 42;
+}
+
+class B {}
+
+class C = B with A;
+
+class D extends C {
+ bar() => 54;
+}
+
+class E extends A {
+ bar() => 68;
+}
+
+main() {
+ Expect.equals(54, new D().foo());
+ Expect.equals(68, new E().foo());
+}
diff --git a/tests/language/mixin_legacy/type_parameter1_test.dart b/tests/language/mixin_legacy/type_parameter1_test.dart
new file mode 100644
index 0000000..90f3490
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameter1_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+abstract class Mixin1<T> {}
+
+abstract class Mixin2<T> {}
+
+class A {}
+
+class MyTypedef<K, V> = A with Mixin1<K>, Mixin2<V>;
+
+class B<K, V> extends MyTypedef<K, V> {}
+
+main() {
+ var b = new B<num, String>();
+ Expect.isTrue(b is Mixin1<num>);
+ Expect.isTrue(b is! Mixin1<String>);
+ Expect.isTrue(b is Mixin2<String>);
+ Expect.isTrue(b is! Mixin2<num>);
+}
diff --git a/tests/language/mixin_legacy/type_parameter2_test.dart b/tests/language/mixin_legacy/type_parameter2_test.dart
new file mode 100644
index 0000000..3a1662c
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameter2_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+abstract class Mixin1<T> {}
+
+abstract class Mixin2<T> {}
+
+class A {
+ A(foo);
+}
+
+class MyTypedef<K, V> = A with Mixin1<K>, Mixin2<V>;
+
+class B<K, V> extends MyTypedef<K, V> {
+ B(foo) : super(foo);
+}
+
+main() {
+ var b = new B<num, String>(null);
+ Expect.isTrue(b is Mixin1<num>);
+ Expect.isTrue(b is! Mixin1<String>);
+ Expect.isTrue(b is Mixin2<String>);
+ Expect.isTrue(b is! Mixin2<num>);
+}
diff --git a/tests/language/mixin_legacy/type_parameter3_test.dart b/tests/language/mixin_legacy/type_parameter3_test.dart
new file mode 100644
index 0000000..6984ffd
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameter3_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+abstract class Mixin1<T> {}
+
+abstract class Mixin2<T> {}
+
+class A {
+ A(foo);
+}
+
+class B<K, V> extends A with Mixin1<K>, Mixin2<V> {
+ B(foo) : super(foo);
+}
+
+main() {
+ var b = new B<num, String>(null);
+ Expect.isTrue(b is Mixin1<num>);
+ Expect.isTrue(b is! Mixin1<String>);
+ Expect.isTrue(b is Mixin2<String>);
+ Expect.isTrue(b is! Mixin2<num>);
+}
diff --git a/tests/language/mixin_legacy/type_parameter4_test.dart b/tests/language/mixin_legacy/type_parameter4_test.dart
new file mode 100644
index 0000000..7015e0f
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameter4_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class R<E, F> {}
+
+class M<J> implements R<bool, J> {}
+
+class B1 {}
+
+class B2 {}
+
+class A1<T> extends B1 with M<T> {}
+
+class A2<T> = B2 with M<T>;
+
+main() {
+ var a1 = new A1<int>();
+ Expect.isTrue(a1 is R<bool, int>);
+ var a2 = new A2<int>();
+ Expect.isTrue(a2 is R<bool, int>);
+}
diff --git a/tests/language/mixin_legacy/type_parameter5_test.dart b/tests/language/mixin_legacy/type_parameter5_test.dart
new file mode 100644
index 0000000..6e06693
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameter5_test.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class MixinA<T> {
+ T? intField;
+}
+
+class MixinB<S> {
+ S? stringField;
+}
+
+class MixinC<U, V> {
+ U? listField;
+ V? mapField;
+}
+
+class C extends Object with MixinA<int>, MixinB<String>, MixinC<List, Map> {}
+
+void main() {
+ var c = new C();
+ c.intField = 0;
+ c.stringField = '';
+ c.listField = [];
+ c.mapField = {};
+}
diff --git a/tests/language/mixin_legacy/type_parameter6_test.dart b/tests/language/mixin_legacy/type_parameter6_test.dart
new file mode 100644
index 0000000..29d9c37
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameter6_test.dart
@@ -0,0 +1,19 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class A<T> {}
+
+class B<S> {
+ int? foo(S s) => null;
+}
+
+class C extends A<int> with B<String> {}
+
+main() {
+ var list = <String>['foo'];
+ var c = new C();
+ list.map(c.foo);
+}
diff --git a/tests/language/mixin_legacy/type_parameter_inference_error_test.dart b/tests/language/mixin_legacy/type_parameter_inference_error_test.dart
new file mode 100644
index 0000000..0349944
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameter_inference_error_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+abstract class A<T> {}
+
+class B {}
+
+mixin M<T> on A<T> {}
+
+// No matching class from which to infer the type parameter of M
+class C extends Object with M {} //# 01: compile-time error
+
+class C = Object with M; //# 02: compile-time error
+
+// Satisfying the constraint with an "implements" clause is not sufficient
+class C extends Object with M implements A<B> {} //# 03: compile-time error
+
+class C = Object with M implements A<B>; //# 04: compile-time error
+
+// Mixin works when used correctly.
+class D = A<B> with M<B>;
+
+main() {}
diff --git a/tests/language/mixin_legacy/type_parameter_inference_previous_mixin_test.dart b/tests/language/mixin_legacy/type_parameter_inference_previous_mixin_test.dart
new file mode 100644
index 0000000..05ab1e4
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameter_inference_previous_mixin_test.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+abstract class A<T> {
+ // This is ok because type inference will ensure that in C, A and M are
+ // instantiated with the same T.
+ T f(T x) => x; //# 01: ok
+}
+
+class B {}
+
+abstract class M1 implements A<B> {}
+
+mixin M2<T> on A<T> {
+ T f(T x) => x;
+ T g(T x) => x;
+ Type h() => T;
+}
+
+// Inferred as `class C extends Object with M1, M2<B>`
+class C extends Object with M1, M2 {}
+
+main() {
+ C c = new C();
+
+ // M is instantiated with B, so C.g has type (B) -> B.
+ B Function(B) x = c.g; //# 02: ok
+ Null Function(Null) x = c.g; //# 03: compile-time error
+ Object Function(Object) x = c.g; //# 04: compile-time error
+
+ // And verify that the runtime system has the right type for the type
+ // parameter
+ Expect.equals(c.h(), B); //# 05: ok
+}
diff --git a/tests/language/mixin_legacy/type_parameter_inference_test.dart b/tests/language/mixin_legacy/type_parameter_inference_test.dart
new file mode 100644
index 0000000..04a6c10
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameter_inference_test.dart
@@ -0,0 +1,75 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+abstract class A<T> {
+ // This is ok because type inference will ensure that in C, A and M are
+ // instantiated with the same T.
+ T f(T x) => x; //# 01: ok
+}
+
+class B {}
+
+mixin M1<T> on A<T> {
+ T f(T x) => x;
+ T g(T x) => x;
+ Type h() => T;
+}
+
+class M2<T> {
+ T g(T x) => x;
+ Type h() => T;
+}
+
+// Inferred as `class C extends A<B> with M1<B>`
+class C extends A<B> with M1 {}
+
+// Inferred as `class D = A<B> with M1<B>`
+class D = A<B> with M1;
+
+// Inferred as `class E extends Object with M2<dynamic>`
+class E extends Object with M2 {}
+
+// Ok because a type parameter is supplied
+class F extends Object with M2<B> {}
+
+main() {
+ C c = new C();
+ D d = new D();
+ E e = new E();
+ F f = new F();
+
+ // M1 is instantiated with B, so C.g has type (B) -> B.
+ B Function(B) x = c.g; //# 02: ok
+ B Function(B) x = d.g; //# 03: ok
+ Null Function(Null) x = c.g; //# 04: compile-time error
+ Null Function(Null) x = d.g; //# 05: compile-time error
+ Object Function(Object) x = c.g; //# 06: compile-time error
+ Object Function(Object) x = d.g; //# 07: compile-time error
+
+ // And verify that the runtime system has the right type for the type
+ // parameter
+ Expect.equals(c.h(), B); //# 08: ok
+ Expect.equals(c.h(), B); //# 09: ok
+
+ // M2 is instantiated with dynamic, so E.g has type (dynamic) -> dynamic.
+ dynamic Function(dynamic) x = e.g; //# 10: ok
+ B Function(B) x = e.g; //# 11: compile-time error
+
+ // And verify that the runtime system has the right type for the type
+ // parameter
+ Expect.equals(e.h(), dynamic); //# 12: ok
+
+ // M2 is instantiated with B, so F.g has type (B) -> B.
+ B Function(B) x = f.g; //# 13: ok
+ Null Function(Null) x = f.g; //# 14: compile-time error
+ Object Function(Object) x = f.g; //# 15: compile-time error
+
+ // And verify that the runtime system has the right type for the type
+ // parameter
+ Expect.equals(f.h(), B); //# 16: ok
+}
diff --git a/tests/language/mixin_legacy/type_parameters_errors_runtime_test.dart b/tests/language/mixin_legacy/type_parameters_errors_runtime_test.dart
new file mode 100644
index 0000000..b388cbb
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameters_errors_runtime_test.dart
@@ -0,0 +1,24 @@
+// TODO(multitest): This was automatically migrated from a multitest and may
+// contain strange or dead code.
+
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class S<T> {}
+
+class M<U> {}
+
+class A<X> extends S<int> with M<double> {}
+
+class F<X> = S<X> with M<X>;
+
+main() {
+ var a;
+ a = new A();
+ a = new A<int>();
+
+ a = new F<int>();
+}
diff --git a/tests/language/mixin_legacy/type_parameters_errors_test.dart b/tests/language/mixin_legacy/type_parameters_errors_test.dart
new file mode 100644
index 0000000..fc694e15
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameters_errors_test.dart
@@ -0,0 +1,45 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+class S<T> {}
+
+class M<U> {}
+
+class A<X> extends S<int> with M<double> {}
+
+class B<U, V> extends S with M<U, V> {}
+// ^
+// [cfe] The type 'M<U, V>' can't be mixed in.
+// ^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+// [cfe] Expected 1 type arguments.
+class C<A, B> extends S<A, int> with M {}
+// ^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+// [cfe] Expected 1 type arguments.
+
+class F<X> = S<X> with M<X>;
+class G = S<int> with M<double, double>;
+// ^
+// [cfe] The type 'M<double, double>' can't be mixed in.
+// ^^^^^^^^^^^^^^^^^
+// [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+// [cfe] Expected 1 type arguments.
+
+main() {
+ var a;
+ a = new A();
+ a = new A<int>();
+ a = new A<String, String>();
+ // ^^^^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Expected 1 type arguments.
+ a = new F<int>();
+ a = new F<int, String>();
+ // ^^^^^^^^^^^^^^
+ // [analyzer] COMPILE_TIME_ERROR.WRONG_NUMBER_OF_TYPE_ARGUMENTS
+ // [cfe] Expected 1 type arguments.
+}
diff --git a/tests/language/mixin_legacy/type_parameters_mixin_extends_test.dart b/tests/language/mixin_legacy/type_parameters_mixin_extends_test.dart
new file mode 100644
index 0000000..5ed3f81
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameters_mixin_extends_test.dart
@@ -0,0 +1,132 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class M<T> {
+ bool matches(o) {
+ bool isChecked = checkUsingIs(o);
+ if (checkedMode) {
+ Expect.equals(isChecked, checkUsingCheckedMode(o));
+ }
+ return isChecked;
+ }
+
+ bool checkUsingIs(o) {
+ return o is T;
+ }
+
+ bool checkUsingCheckedMode(o) {
+ try {
+ T x = o;
+ } on Error {
+ return false;
+ }
+ return true;
+ }
+
+ static final bool checkedMode = computeCheckedMode();
+ static bool computeCheckedMode() {
+ try {
+ int x = "foo" as dynamic;
+ } on Error {
+ return true;
+ }
+ return false;
+ }
+}
+
+class S {}
+
+class C0<T> extends S with M {}
+
+class C1<T> extends S with M<T> {}
+
+class C2<T> extends S with M<int> {}
+
+class C3 extends S with M<String> {}
+
+main() {
+ var c0 = new C0();
+ Expect.isTrue(c0 is M);
+ Expect.isFalse(c0 is M<int>);
+ Expect.isFalse(c0 is M<String>);
+ Expect.isTrue(c0.matches(c0));
+ Expect.isTrue(c0.matches(42));
+ Expect.isTrue(c0.matches("hello"));
+
+ var c0_int = new C0<int>();
+ Expect.isTrue(c0_int is M);
+ Expect.isFalse(c0_int is M<int>);
+ Expect.isFalse(c0_int is M<String>);
+ Expect.isTrue(c0_int.matches(c0));
+ Expect.isTrue(c0_int.matches(42));
+ Expect.isTrue(c0_int.matches("hello"));
+
+ var c0_String = new C0<String>();
+ Expect.isTrue(c0_String is M);
+ Expect.isFalse(c0_String is M<int>);
+ Expect.isFalse(c0_String is M<String>);
+ Expect.isTrue(c0_String.matches(c0));
+ Expect.isTrue(c0_String.matches(42));
+ Expect.isTrue(c0_String.matches("hello"));
+
+ var c1 = new C1();
+ Expect.isTrue(c1 is M);
+ Expect.isFalse(c1 is M<int>);
+ Expect.isFalse(c1 is M<String>);
+ Expect.isTrue(c1.matches(c1));
+ Expect.isTrue(c1.matches(42));
+ Expect.isTrue(c1.matches("hello"));
+
+ var c1_int = new C1<int>();
+ Expect.isTrue(c1_int is M);
+ Expect.isTrue(c1_int is M<int>);
+ Expect.isFalse(c1_int is M<String>);
+ Expect.isFalse(c1_int.matches(c1));
+ Expect.isTrue(c1_int.matches(42));
+ Expect.isFalse(c1_int.matches("hello"));
+
+ var c1_String = new C1<String>();
+ Expect.isTrue(c1_String is M);
+ Expect.isFalse(c1_String is M<int>);
+ Expect.isTrue(c1_String is M<String>);
+ Expect.isFalse(c1_String.matches(c1));
+ Expect.isFalse(c1_String.matches(42));
+ Expect.isTrue(c1_String.matches("hello"));
+
+ var c2 = new C2();
+ Expect.isTrue(c2 is M);
+ Expect.isTrue(c2 is M<int>);
+ Expect.isFalse(c2 is M<String>);
+ Expect.isFalse(c2.matches(c2));
+ Expect.isTrue(c2.matches(42));
+ Expect.isFalse(c2.matches("hello"));
+
+ var c2_int = new C2<int>();
+ Expect.isTrue(c2_int is M);
+ Expect.isTrue(c2_int is M<int>);
+ Expect.isFalse(c2_int is M<String>);
+ Expect.isFalse(c2_int.matches(c2));
+ Expect.isTrue(c2_int.matches(42));
+ Expect.isFalse(c2_int.matches("hello"));
+
+ var c2_String = new C2<String>();
+ Expect.isTrue(c2_String is M);
+ Expect.isTrue(c2_String is M<int>);
+ Expect.isFalse(c2_String is M<String>);
+ Expect.isFalse(c2_String.matches(c2));
+ Expect.isTrue(c2_String.matches(42));
+ Expect.isFalse(c2_String.matches("hello"));
+
+ var c3 = new C3();
+ Expect.isTrue(c3 is M);
+ Expect.isFalse(c3 is M<int>);
+ Expect.isTrue(c3 is M<String>);
+ Expect.isFalse(c3.matches(c2));
+ Expect.isFalse(c3.matches(42));
+ Expect.isTrue(c3.matches("hello"));
+}
diff --git a/tests/language/mixin_legacy/type_parameters_mixin_test.dart b/tests/language/mixin_legacy/type_parameters_mixin_test.dart
new file mode 100644
index 0000000..cd3a558
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameters_mixin_test.dart
@@ -0,0 +1,129 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class M<T> {
+ bool matches(o) {
+ bool isChecked = checkUsingIs(o);
+ if (checkedMode) {
+ Expect.equals(isChecked, checkUsingCheckedMode(o));
+ }
+ return isChecked;
+ }
+
+ bool checkUsingIs(o) {
+ return o is T;
+ }
+
+ bool checkUsingCheckedMode(o) {
+ try {
+ T x = o;
+ } on Error {
+ return false;
+ }
+ return true;
+ }
+
+ static final bool checkedMode = computeCheckedMode();
+ static bool computeCheckedMode() {
+ try {
+ int x = "foo" as dynamic;
+ } on Error {
+ return true;
+ }
+ return false;
+ }
+}
+
+class S {}
+
+class C0<T> = S with M;
+class C1<T> = S with M<T>;
+class C2<T> = S with M<int>;
+class C3 = S with M<String>;
+
+main() {
+ var c0 = new C0();
+ Expect.isTrue(c0 is M);
+ Expect.isFalse(c0 is M<int>);
+ Expect.isFalse(c0 is M<String>);
+ Expect.isTrue(c0.matches(c0));
+ Expect.isTrue(c0.matches(42));
+ Expect.isTrue(c0.matches("hello"));
+
+ var c0_int = new C0<int>();
+ Expect.isTrue(c0_int is M);
+ Expect.isFalse(c0_int is M<int>);
+ Expect.isFalse(c0_int is M<String>);
+ Expect.isTrue(c0_int.matches(c0));
+ Expect.isTrue(c0_int.matches(42));
+ Expect.isTrue(c0_int.matches("hello"));
+
+ var c0_String = new C0<String>();
+ Expect.isTrue(c0_String is M);
+ Expect.isFalse(c0_String is M<int>);
+ Expect.isFalse(c0_String is M<String>);
+ Expect.isTrue(c0_String.matches(c0));
+ Expect.isTrue(c0_String.matches(42));
+ Expect.isTrue(c0_String.matches("hello"));
+
+ var c1 = new C1();
+ Expect.isTrue(c1 is M);
+ Expect.isFalse(c1 is M<int>);
+ Expect.isFalse(c1 is M<String>);
+ Expect.isTrue(c1.matches(c1));
+ Expect.isTrue(c1.matches(42));
+ Expect.isTrue(c1.matches("hello"));
+
+ var c1_int = new C1<int>();
+ Expect.isTrue(c1_int is M);
+ Expect.isTrue(c1_int is M<int>);
+ Expect.isFalse(c1_int is M<String>);
+ Expect.isFalse(c1_int.matches(c1));
+ Expect.isTrue(c1_int.matches(42));
+ Expect.isFalse(c1_int.matches("hello"));
+
+ var c1_String = new C1<String>();
+ Expect.isTrue(c1_String is M);
+ Expect.isFalse(c1_String is M<int>);
+ Expect.isTrue(c1_String is M<String>);
+ Expect.isFalse(c1_String.matches(c1));
+ Expect.isFalse(c1_String.matches(42));
+ Expect.isTrue(c1_String.matches("hello"));
+
+ var c2 = new C2();
+ Expect.isTrue(c2 is M);
+ Expect.isTrue(c2 is M<int>);
+ Expect.isFalse(c2 is M<String>);
+ Expect.isFalse(c2.matches(c2));
+ Expect.isTrue(c2.matches(42));
+ Expect.isFalse(c2.matches("hello"));
+
+ var c2_int = new C2<int>();
+ Expect.isTrue(c2_int is M);
+ Expect.isTrue(c2_int is M<int>);
+ Expect.isFalse(c2_int is M<String>);
+ Expect.isFalse(c2_int.matches(c2));
+ Expect.isTrue(c2_int.matches(42));
+ Expect.isFalse(c2_int.matches("hello"));
+
+ var c2_String = new C2<String>();
+ Expect.isTrue(c2_String is M);
+ Expect.isTrue(c2_String is M<int>);
+ Expect.isFalse(c2_String is M<String>);
+ Expect.isFalse(c2_String.matches(c2));
+ Expect.isTrue(c2_String.matches(42));
+ Expect.isFalse(c2_String.matches("hello"));
+
+ var c3 = new C3();
+ Expect.isTrue(c3 is M);
+ Expect.isFalse(c3 is M<int>);
+ Expect.isTrue(c3 is M<String>);
+ Expect.isFalse(c3.matches(c2));
+ Expect.isFalse(c3.matches(42));
+ Expect.isTrue(c3.matches("hello"));
+}
diff --git a/tests/language/mixin_legacy/type_parameters_simple_test.dart b/tests/language/mixin_legacy/type_parameters_simple_test.dart
new file mode 100644
index 0000000..ac8d143
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameters_simple_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S {}
+
+class M1<X> {
+ m1() => X;
+}
+
+class M2<Y> {
+ m2() => Y;
+}
+
+class A<T> extends S with M1<T>, M2<T> {}
+
+main() {
+ var a = new A<int>();
+ // Getting "int" when calling toString() on the int type is not required.
+ // However, we want to keep the original names for the most common core types
+ // so we make sure to handle these specifically in the compiler.
+ Expect.equals("int", a.m1().toString());
+ Expect.equals("int", a.m2().toString());
+ var a2 = new A<String>();
+ Expect.equals("String", a2.m1().toString());
+ Expect.equals("String", a2.m2().toString());
+}
diff --git a/tests/language/mixin_legacy/type_parameters_super_extends_test.dart b/tests/language/mixin_legacy/type_parameters_super_extends_test.dart
new file mode 100644
index 0000000..8697a4d
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameters_super_extends_test.dart
@@ -0,0 +1,132 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S<T> {
+ bool matches(o) {
+ bool isChecked = checkUsingIs(o);
+ if (checkedMode) {
+ Expect.equals(isChecked, checkUsingCheckedMode(o));
+ }
+ return isChecked;
+ }
+
+ bool checkUsingIs(o) {
+ return o is T;
+ }
+
+ bool checkUsingCheckedMode(o) {
+ try {
+ T x = o;
+ } on Error {
+ return false;
+ }
+ return true;
+ }
+
+ static final bool checkedMode = computeCheckedMode();
+ static bool computeCheckedMode() {
+ try {
+ int x = "foo" as dynamic;
+ } on Error {
+ return true;
+ }
+ return false;
+ }
+}
+
+class M {}
+
+class C0<T> extends S with M {}
+
+class C1<T> extends S<T> with M {}
+
+class C2<T> extends S<int> with M {}
+
+class C3 extends S<String> with M {}
+
+main() {
+ var c0 = new C0();
+ Expect.isTrue(c0 is S);
+ Expect.isFalse(c0 is S<int>);
+ Expect.isFalse(c0 is S<String>);
+ Expect.isTrue(c0.matches(c0));
+ Expect.isTrue(c0.matches(42));
+ Expect.isTrue(c0.matches("hello"));
+
+ var c0_int = new C0<int>();
+ Expect.isTrue(c0_int is S);
+ Expect.isFalse(c0_int is S<int>);
+ Expect.isFalse(c0_int is S<String>);
+ Expect.isTrue(c0_int.matches(c0));
+ Expect.isTrue(c0_int.matches(42));
+ Expect.isTrue(c0_int.matches("hello"));
+
+ var c0_String = new C0<String>();
+ Expect.isTrue(c0_String is S);
+ Expect.isFalse(c0_String is S<int>);
+ Expect.isFalse(c0_String is S<String>);
+ Expect.isTrue(c0_String.matches(c0));
+ Expect.isTrue(c0_String.matches(42));
+ Expect.isTrue(c0_String.matches("hello"));
+
+ var c1 = new C1();
+ Expect.isTrue(c1 is S);
+ Expect.isFalse(c1 is S<int>);
+ Expect.isFalse(c1 is S<String>);
+ Expect.isTrue(c1.matches(c1));
+ Expect.isTrue(c1.matches(42));
+ Expect.isTrue(c1.matches("hello"));
+
+ var c1_int = new C1<int>();
+ Expect.isTrue(c1_int is S);
+ Expect.isTrue(c1_int is S<int>);
+ Expect.isFalse(c1_int is S<String>);
+ Expect.isFalse(c1_int.matches(c1));
+ Expect.isTrue(c1_int.matches(42));
+ Expect.isFalse(c1_int.matches("hello"));
+
+ var c1_String = new C1<String>();
+ Expect.isTrue(c1_String is S);
+ Expect.isFalse(c1_String is S<int>);
+ Expect.isTrue(c1_String is S<String>);
+ Expect.isFalse(c1_String.matches(c1));
+ Expect.isFalse(c1_String.matches(42));
+ Expect.isTrue(c1_String.matches("hello"));
+
+ var c2 = new C2();
+ Expect.isTrue(c2 is S);
+ Expect.isTrue(c2 is S<int>);
+ Expect.isFalse(c2 is S<String>);
+ Expect.isFalse(c2.matches(c2));
+ Expect.isTrue(c2.matches(42));
+ Expect.isFalse(c2.matches("hello"));
+
+ var c2_int = new C2<int>();
+ Expect.isTrue(c2_int is S);
+ Expect.isTrue(c2_int is S<int>);
+ Expect.isFalse(c2_int is S<String>);
+ Expect.isFalse(c2_int.matches(c2));
+ Expect.isTrue(c2_int.matches(42));
+ Expect.isFalse(c2_int.matches("hello"));
+
+ var c2_String = new C2<String>();
+ Expect.isTrue(c2_String is S);
+ Expect.isTrue(c2_String is S<int>);
+ Expect.isFalse(c2_String is S<String>);
+ Expect.isFalse(c2_String.matches(c2));
+ Expect.isTrue(c2_String.matches(42));
+ Expect.isFalse(c2_String.matches("hello"));
+
+ var c3 = new C3();
+ Expect.isTrue(c3 is S);
+ Expect.isFalse(c3 is S<int>);
+ Expect.isTrue(c3 is S<String>);
+ Expect.isFalse(c3.matches(c2));
+ Expect.isFalse(c3.matches(42));
+ Expect.isTrue(c3.matches("hello"));
+}
diff --git a/tests/language/mixin_legacy/type_parameters_super_test.dart b/tests/language/mixin_legacy/type_parameters_super_test.dart
new file mode 100644
index 0000000..4725ae5
--- /dev/null
+++ b/tests/language/mixin_legacy/type_parameters_super_test.dart
@@ -0,0 +1,100 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class S<T> {
+ bool matches(o) => o is T;
+}
+
+class M {}
+
+class C0<T> = S with M;
+class C1<T> = S<T> with M;
+class C2<T> = S<int> with M;
+class C3 = S<String> with M;
+
+main() {
+ var c0 = new C0();
+ Expect.isTrue(c0 is S);
+ Expect.isFalse(c0 is S<int>);
+ Expect.isFalse(c0 is S<String>);
+ Expect.isTrue(c0.matches(c0));
+ Expect.isTrue(c0.matches(42));
+ Expect.isTrue(c0.matches("hello"));
+
+ var c0_int = new C0<int>();
+ Expect.isTrue(c0_int is S);
+ Expect.isFalse(c0_int is S<int>);
+ Expect.isFalse(c0_int is S<String>);
+ Expect.isTrue(c0_int.matches(c0));
+ Expect.isTrue(c0_int.matches(42));
+ Expect.isTrue(c0_int.matches("hello"));
+
+ var c0_String = new C0<String>();
+ Expect.isTrue(c0_String is S);
+ Expect.isFalse(c0_String is S<int>);
+ Expect.isFalse(c0_String is S<String>);
+ Expect.isTrue(c0_String.matches(c0));
+ Expect.isTrue(c0_String.matches(42));
+ Expect.isTrue(c0_String.matches("hello"));
+
+ var c1 = new C1();
+ Expect.isTrue(c1 is S);
+ Expect.isFalse(c1 is S<int>);
+ Expect.isFalse(c1 is S<String>);
+ Expect.isTrue(c1.matches(c1));
+ Expect.isTrue(c1.matches(42));
+ Expect.isTrue(c1.matches("hello"));
+
+ var c1_int = new C1<int>();
+ Expect.isTrue(c1_int is S);
+ Expect.isTrue(c1_int is S<int>);
+ Expect.isFalse(c1_int is S<String>);
+ Expect.isFalse(c1_int.matches(c1));
+ Expect.isTrue(c1_int.matches(42));
+ Expect.isFalse(c1_int.matches("hello"));
+
+ var c1_String = new C1<String>();
+ Expect.isTrue(c1_String is S);
+ Expect.isFalse(c1_String is S<int>);
+ Expect.isTrue(c1_String is S<String>);
+ Expect.isFalse(c1_String.matches(c1));
+ Expect.isFalse(c1_String.matches(42));
+ Expect.isTrue(c1_String.matches("hello"));
+
+ var c2 = new C2();
+ Expect.isTrue(c2 is S);
+ Expect.isTrue(c2 is S<int>);
+ Expect.isFalse(c2 is S<String>);
+ Expect.isFalse(c2.matches(c2));
+ Expect.isTrue(c2.matches(42));
+ Expect.isFalse(c2.matches("hello"));
+
+ var c2_int = new C2<int>();
+ Expect.isTrue(c2_int is S);
+ Expect.isTrue(c2_int is S<int>);
+ Expect.isFalse(c2_int is S<String>);
+ Expect.isFalse(c2_int.matches(c2));
+ Expect.isTrue(c2_int.matches(42));
+ Expect.isFalse(c2_int.matches("hello"));
+
+ var c2_String = new C2<String>();
+ Expect.isTrue(c2_String is S);
+ Expect.isTrue(c2_String is S<int>);
+ Expect.isFalse(c2_String is S<String>);
+ Expect.isFalse(c2_String.matches(c2));
+ Expect.isTrue(c2_String.matches(42));
+ Expect.isFalse(c2_String.matches("hello"));
+
+ var c3 = new C3();
+ Expect.isTrue(c3 is S);
+ Expect.isFalse(c3 is S<int>);
+ Expect.isTrue(c3 is S<String>);
+ Expect.isFalse(c3.matches(c2));
+ Expect.isFalse(c3.matches(42));
+ Expect.isTrue(c3.matches("hello"));
+}
diff --git a/tests/language/mixin_legacy/type_variable_test.dart b/tests/language/mixin_legacy/type_variable_test.dart
new file mode 100644
index 0000000..3971ec1
--- /dev/null
+++ b/tests/language/mixin_legacy/type_variable_test.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+// Regression test for generic mixin fields.
+
+class A<T> {
+ T? field;
+}
+
+class B<T> = Object with A<T>;
+
+class C<T> extends B<T> {} //# 03: ok
+class D extends B<int> {} //# 04: ok
+
+class E = Object with A<int>;
+
+class F extends E {} //# 06: ok
+
+class G<T> extends Object with A<T> {} //# 07: ok
+class H extends Object with A<int> {} //# 08: ok
+
+void main() {
+ new A<num>(); //# 01: ok
+ new B<num>(); //# 02: ok
+ new C<num>(); //# 03: continued
+ new D(); //# 04: continued
+ new E(); //# 05: ok
+ new F(); //# 06: continued
+ new G<num>(); //# 07: continued
+ new H(); //# 08: continued
+}
diff --git a/tests/language/mixin_legacy/typedef_constructor_test.dart b/tests/language/mixin_legacy/typedef_constructor_test.dart
new file mode 100644
index 0000000..750b3e1
--- /dev/null
+++ b/tests/language/mixin_legacy/typedef_constructor_test.dart
@@ -0,0 +1,24 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class A {
+ var field;
+ A(this.field);
+}
+
+class Mixin {
+ var mixinField = 54;
+}
+
+class MyClass = A with Mixin;
+
+main() {
+ var a = new MyClass(42);
+ Expect.equals(42, a.field);
+ Expect.equals(54, a.mixinField);
+}
diff --git a/tests/language/mixin_legacy/with_named_import_test.dart b/tests/language/mixin_legacy/with_named_import_test.dart
new file mode 100644
index 0000000..37a1575
--- /dev/null
+++ b/tests/language/mixin_legacy/with_named_import_test.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import 'dart:collection' as collection;
+
+class Foo extends Object with collection.ListMixin {
+ int get length => 0;
+ operator [](int index) => null;
+ void operator []=(int index, value) => null;
+ set length(int newLength) => null;
+}
+
+main() {
+ new Foo();
+}
diff --git a/tests/language/mixin_legacy/with_two_implicit_constructors_test.dart b/tests/language/mixin_legacy/with_two_implicit_constructors_test.dart
new file mode 100644
index 0000000..cf872a2
--- /dev/null
+++ b/tests/language/mixin_legacy/with_two_implicit_constructors_test.dart
@@ -0,0 +1,22 @@
+// Copyright (c) 2023, 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.
+
+// @dart=2.19
+
+import "package:expect/expect.dart";
+
+class A {
+ var field;
+ A.bar() : field = 1;
+ A() : field = 2;
+}
+
+class Mixin {}
+
+class B extends A with Mixin {}
+
+main() {
+ Expect.equals(2, new B().field);
+ new B.bar(); /*@compile-error=unspecified*/
+}