Issue #1087: New Constructor Tear Offs tests added
diff --git a/LanguageFeatures/Constructor-tear-offs/goal_t01_A02.dart b/LanguageFeatures/Constructor-tear-offs/goal_t01_A02.dart
index 72c6764..7b8adfa 100644
--- a/LanguageFeatures/Constructor-tear-offs/goal_t01_A02.dart
+++ b/LanguageFeatures/Constructor-tear-offs/goal_t01_A02.dart
@@ -32,7 +32,7 @@
var v1 = C.constr1;
var v2 = (C.constr1);
var v3 = (C.constr1<dynamic>);
- var v4 = (C.constr1)<dynamic>);
+ var v4 = (C.constr1)<dynamic>;
Expect.equals(v1, v2);
Expect.equals(v1, v3);
Expect.equals(v1, v4);
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A02_t02.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A02_t02.dart
index 0483602..0738cfe 100644
--- a/LanguageFeatures/Constructor-tear-offs/named_constructor_A02_t02.dart
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A02_t02.dart
@@ -21,12 +21,12 @@
}
main() {
- Expect.isTrue(C.constr is C Function<dynamic>(dynamic));
- Expect.isTrue(C.new is C Function<dynamic>(dynamic));
+ Expect.isTrue(C.constr is C Function<X extends dynamic>(X));
+ Expect.isTrue(C.new is C Function<X extends dynamic>());
- Expect.isTrue(C<int>.constr is C Function<int>(int));
- Expect.isTrue(C<int>.new is C Function<int>());
+ Expect.isTrue(C<int>.constr is C Function<X extends int>(X));
+ Expect.isTrue(C<int>.new is C Function<X extends int>());
- Expect.isTrue(C.constr<int> is C Function<int>(int));
- Expect.isTrue(C.new<int> is C Function<int>());
+ Expect.isTrue(C.constr<int> is C Function<T extends int>(T));
+ Expect.isTrue(C.new<int> is C Function<T extends int>());
}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A05_t01.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A05_t01.dart
new file mode 100644
index 0000000..bee83a6
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A05_t01.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion When tearing off a constructor of a generic class using [C.name],
+/// the type arguments may be implicitly instantiated, just as for a normal
+/// generic method tear-off of the corresponding static function. The
+/// instantiation is based on the context-type at the tear-off position. If the
+/// context types allows a generic function, the tear-off is not instantiated
+/// and the result is a generic function.
+///
+/// @description Checks that type arguments can be implicitly instantiated.
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C<T1, T2 extends num, T3 extends String> {
+ C.constr() {}
+ C.constr1(T1 t, T2 t2) {}
+}
+
+main() {
+ Expect.isTrue(C.constr is C Function<T1 extends dynamic, T2 extends num, T3 extends String>());
+ Expect.isTrue(C.constr1 is C Function<T1 extends dynamic, T2 extends num, T3 extends String>(T1, T2));
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A05_t02.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A05_t02.dart
new file mode 100644
index 0000000..7741bab
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A05_t02.dart
@@ -0,0 +1,51 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion When tearing off a constructor of a generic class using [C.name],
+/// the type arguments may be implicitly instantiated, just as for a normal
+/// generic method tear-off of the corresponding static function. The
+/// instantiation is based on the context-type at the tear-off position. If the
+/// context types allows a generic function, the tear-off is not instantiated
+/// and the result is a generic function.
+///
+/// @description Checks that type arguments can be implicitly instantiated.
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C<T1, T2 extends num, T3 extends String> {
+ var t1, t2, t3;
+ var p1, p2;
+
+ C.constr() {
+ t1 = T1;
+ t2 = T2;
+ t3 = T3;
+ }
+ C.constr1(T1 par1, T2 par2) {
+ t1 = T1;
+ t2 = T2;
+ t3 = T3;
+ p1 = par1;
+ p2 = par2;
+ }
+
+ void check(exp1, exp2, exp3, exp4, exp5) {
+ Expect.equals(exp1, T1);
+ Expect.equals(exp2, T2);
+ Expect.equals(exp3, T3);
+ Expect.equals(exp4, p1);
+ Expect.equals(exp5, p2);
+ }
+}
+
+main() {
+ var v = C.constr;
+ C c = v();
+ c.check(dynamic, num, String, null, null);
+
+ var v1 = C.constr1;
+ C c1 = v1(1, 2);
+ c1.check(dynamic, num, String, 1, 2);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A06_t01.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A06_t01.dart
new file mode 100644
index 0000000..a8aed24
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A06_t01.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion When tearing off a constructor of a generic class using
+/// [C<typeArgs>.name, the torn off method is always instantiated to the
+/// provided type arguments (which must be valid type arguments for the
+/// class/corresponding function). It otherwise behaves as an implicitly
+/// instantiated function tear-off.
+///
+/// @description Checks that type arguments correctly instantiated for
+/// [C<typeArgs>.name.
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C<T1, T2 extends num, T3 extends String> {
+ C.constr() {}
+ C.constr1(T1 t, T2 t2) {}
+}
+
+main() {
+ var v1 = C<dynamic, num, String>.constr;
+ Expect.isTrue(v1 is C Function<T1 extends dynamic, T2 extends num, T3 extends String>());
+
+ var v2 = C<dynamic, num, String>.constr1;
+ Expect.isTrue(v2 is C Function<T1 extends dynamic, T2 extends num, T3 extends String>(dynamic, num));
+
+ var v3 = C<List<int>, int, String>.constr;
+ Expect.isTrue(v3 is C Function<T1 extends List<int>, T2 extends int, T3 extends String>());
+
+ var v4 = C<List<int>, int, String>.constr1;
+ Expect.isTrue(v3 is C Function<T1 extends List<int>, T2 extends int, T3 extends String>(List<int>, int));
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A06_t02.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A06_t02.dart
new file mode 100644
index 0000000..d995679
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A06_t02.dart
@@ -0,0 +1,61 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion When tearing off a constructor of a generic class using [C.name],
+/// the type arguments may be implicitly instantiated, just as for a normal
+/// generic method tear-off of the corresponding static function. The
+/// instantiation is based on the context-type at the tear-off position. If the
+/// context types allows a generic function, the tear-off is not instantiated
+/// and the result is a generic function.
+///
+/// @description Checks that type arguments can be instantiated during the
+/// constructor tearing off.
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C<T1, T2 extends num, T3 extends String> {
+ var t1, t2, t3;
+ var p1, p2;
+
+ C.constr() {
+ t1 = T1;
+ t2 = T2;
+ t3 = T3;
+ }
+ C.constr1(T1 par1, T2 par2) {
+ t1 = T1;
+ t2 = T2;
+ t3 = T3;
+ p1 = par1;
+ p2 = par2;
+ }
+
+ void check(exp1, exp2, exp3, exp4, exp5) {
+ Expect.equals(exp1, T1);
+ Expect.equals(exp2, T2);
+ Expect.equals(exp3, T3);
+ Expect.equals(exp4, p1);
+ Expect.equals(exp5, p2);
+ }
+}
+
+main() {
+ var v1 = C<dynamic, num, String>.constr;
+ C c1 = v1();
+ c1.check(dynamic, num, String, null, null);
+
+ var v2 = C<dynamic, num, String>.constr1;
+ C c2 = v2([], 0);
+ c2.check(dynamic, num, String, [], 0);
+
+ var v3 = C<List, int, String>.constr;
+ C c3 = v3();
+ c3.check(List, int, String, null, null);
+
+ var v4 = C<List, int, String>.constr1;
+ C c4 = v4([], 0);
+ c1.check(List, int, String, [], 0);
+
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t01.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t01.dart
new file mode 100644
index 0000000..7d2ca52
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t01.dart
@@ -0,0 +1,28 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion The constant-ness, identity and equality of the torn-off
+/// constructor functions behave exactly the same as if they were tear-offs of
+/// the corresponding static function. This means that a non-generic class
+/// constructor always tears off to the same function value, as does an
+/// uninstantiated tear off of a generic class constructor.
+///
+/// @description Checks that a non-generic class constructor always tears off to
+/// the same function value: test default constructor
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C {
+ C() {}
+}
+
+main() {
+ var v1 = C.new;
+ var v2 = C.new;
+ var v3 = C.new;
+ Expect.equals(v1, v2);
+ Expect.equals(v1, v3);
+ Expect.equals(v2, v3);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t02.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t02.dart
new file mode 100644
index 0000000..ab4581c
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t02.dart
@@ -0,0 +1,48 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion The constant-ness, identity and equality of the torn-off
+/// constructor functions behave exactly the same as if they were tear-offs of
+/// the corresponding static function. This means that a non-generic class
+/// constructor always tears off to the same function value, as does an
+/// uninstantiated tear off of a generic class constructor.
+///
+/// @description Checks that a non-generic class constructor always tears off to
+/// the same function value: test named constructors
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C {
+ C.name1() {}
+ C.name2(int i) {}
+ C.name3(int i, String s, List l) {}
+}
+
+main() {
+ var v1 = C.name1;
+ var v2 = C.name1;
+ var v3 = C.name1;
+ Expect.equals(v1, v2);
+ Expect.equals(v1, v3);
+ Expect.equals(v2, v3);
+
+ var v4 = C.name2;
+ var v5 = C.name2;
+ var v6 = C.name2;
+ Expect.equals(v4, v5);
+ Expect.equals(v4, v6);
+ Expect.equals(v5, v6);
+
+ var v7 = C.name3;
+ var v8 = C.name3;
+ var v9 = C.name3;
+ Expect.equals(v7, v8);
+ Expect.equals(v7, v9);
+ Expect.equals(v8, v9);
+
+ Expect.notEquals(v1, v4);
+ Expect.notEquals(v2, v7);
+ Expect.notEquals(v5, v9);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t03.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t03.dart
new file mode 100644
index 0000000..9297941
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t03.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion The constant-ness, identity and equality of the torn-off
+/// constructor functions behave exactly the same as if they were tear-offs of
+/// the corresponding static function. This means that a non-generic class
+/// constructor always tears off to the same function value, as does an
+/// uninstantiated tear off of a generic class constructor.
+///
+/// @description Checks that a non-generic class constructor always tears off to
+/// the same function value: test constructors with initializing formals.
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C {
+ int? i, j;
+ C(this.i, this.j) {}
+ C.constr1(this.i, this.j);
+ C.constr2(i, this.j) {}
+}
+
+main() {
+ var v1 = C.new;
+ var v2 = C.new;
+ var v3 = C.new;
+ Expect.equals(v1, v2);
+ Expect.equals(v1, v3);
+ Expect.equals(v2, v3);
+
+ var v4 = C.constr1;
+ var v5 = C.constr1;
+ var v6 = C.constr1;
+ Expect.equals(v4, v5);
+ Expect.equals(v4, v6);
+ Expect.equals(v5, v6);
+
+ var v7 = C.constr1;
+ var v8 = C.constr1;
+ var v9 = C.constr1;
+ Expect.equals(v7, v8);
+ Expect.equals(v7, v9);
+ Expect.equals(v8, v9);
+
+ Expect.notEquals(v1, v4);
+ Expect.notEquals(v2, v7);
+ Expect.notEquals(v5, v9);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t04.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t04.dart
new file mode 100644
index 0000000..4b7c1b3
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t04.dart
@@ -0,0 +1,48 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion The constant-ness, identity and equality of the torn-off
+/// constructor functions behave exactly the same as if they were tear-offs of
+/// the corresponding static function. This means that a non-generic class
+/// constructor always tears off to the same function value, as does an
+/// uninstantiated tear off of a generic class constructor.
+///
+/// @description Checks that a non-generic class constructor always tears off to
+/// the same function value: test constructors with named parameters.
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C {
+ C.name1({int i = 1, j = "testme"}) {}
+ C.name2(int i, {List? l, String check = "check"}) {}
+ C.name3(int i, {String s = "", required l}) {}
+}
+
+main() {
+ var v1 = C.name1;
+ var v2 = C.name1;
+ var v3 = C.name1;
+ Expect.equals(v1, v2);
+ Expect.equals(v1, v3);
+ Expect.equals(v2, v3);
+
+ var v4 = C.name2;
+ var v5 = C.name2;
+ var v6 = C.name2;
+ Expect.equals(v4, v5);
+ Expect.equals(v4, v6);
+ Expect.equals(v5, v6);
+
+ var v7 = C.name3;
+ var v8 = C.name3;
+ var v9 = C.name3;
+ Expect.equals(v7, v8);
+ Expect.equals(v7, v9);
+ Expect.equals(v8, v9);
+
+ Expect.notEquals(v1, v4);
+ Expect.notEquals(v2, v7);
+ Expect.notEquals(v5, v9);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t05.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t05.dart
new file mode 100644
index 0000000..6788117
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t05.dart
@@ -0,0 +1,48 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion The constant-ness, identity and equality of the torn-off
+/// constructor functions behave exactly the same as if they were tear-offs of
+/// the corresponding static function. This means that a non-generic class
+/// constructor always tears off to the same function value, as does an
+/// uninstantiated tear off of a generic class constructor.
+///
+/// @description Checks that a non-generic class constructor always tears off to
+/// the same function value: test constructors with optional parameters.
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C {
+ C.name1([int i = 1, j = "testme"]) {}
+ C.name2(int i, [List? l, String check = "check"]) {}
+ C.name3(int i, [String s = "This is a String", l]) {}
+}
+
+main() {
+ var v1 = C.name1;
+ var v2 = C.name1;
+ var v3 = C.name1;
+ Expect.equals(v1, v2);
+ Expect.equals(v1, v3);
+ Expect.equals(v2, v3);
+
+ var v4 = C.name2;
+ var v5 = C.name2;
+ var v6 = C.name2;
+ Expect.equals(v4, v5);
+ Expect.equals(v4, v6);
+ Expect.equals(v5, v6);
+
+ var v7 = C.name3;
+ var v8 = C.name3;
+ var v9 = C.name3;
+ Expect.equals(v7, v8);
+ Expect.equals(v7, v9);
+ Expect.equals(v8, v9);
+
+ Expect.notEquals(v1, v4);
+ Expect.notEquals(v2, v7);
+ Expect.notEquals(v5, v9);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t06.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t06.dart
new file mode 100644
index 0000000..1ffe66f
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t06.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion The constant-ness, identity and equality of the torn-off
+/// constructor functions behave exactly the same as if they were tear-offs of
+/// the corresponding static function. This means that a non-generic class
+/// constructor always tears off to the same function value, as does an
+/// uninstantiated tear off of a generic class constructor.
+///
+/// @description Checks that a generic class constructor always tears off to
+/// the same function value: test generic constructor.
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C<T> {
+ int? i, j;
+ C.name1(T i, [List? l, T? check]) {}
+ C.name2(this.i, this.j);
+ C() {}
+}
+
+main() {
+ var v1 = C.name1;
+ var v2 = C.name1;
+ var v3 = C.name1;
+ Expect.equals(v1, v2);
+ Expect.equals(v1, v3);
+ Expect.equals(v2, v3);
+
+ var v4 = C.name2;
+ var v5 = C.name2;
+ var v6 = C.name2;
+ Expect.equals(v4, v5);
+ Expect.equals(v4, v6);
+ Expect.equals(v5, v6);
+
+ var v7 = C.new;
+ var v8 = C.new;
+ var v9 = C.new;
+ Expect.equals(v7, v8);
+ Expect.equals(v7, v9);
+ Expect.equals(v8, v9);
+
+ Expect.notEquals(v1, v4);
+ Expect.notEquals(v2, v7);
+ Expect.notEquals(v5, v9);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t07.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t07.dart
new file mode 100644
index 0000000..df765fb
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A07_t07.dart
@@ -0,0 +1,49 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion The constant-ness, identity and equality of the torn-off
+/// constructor functions behave exactly the same as if they were tear-offs of
+/// the corresponding static function. This means that a non-generic class
+/// constructor always tears off to the same function value, as does an
+/// uninstantiated tear off of a generic class constructor.
+///
+/// @description Checks that a generic class constructor always tears off to
+/// the same function value: test generic constructor.
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C<T1 extends int, T2, T3 extends List> {
+ int? i, j;
+ C.name1(T i, [List? l, T? check]) {}
+ C.name2(this.i, this.j);
+ C() {}
+}
+
+main() {
+ var v1 = C.name1;
+ var v2 = C.name1;
+ var v3 = C.name1;
+ Expect.equals(v1, v2);
+ Expect.equals(v1, v3);
+ Expect.equals(v2, v3);
+
+ var v4 = C.name2;
+ var v5 = C.name2;
+ var v6 = C.name2;
+ Expect.equals(v4, v5);
+ Expect.equals(v4, v6);
+ Expect.equals(v5, v6);
+
+ var v7 = C.new;
+ var v8 = C.new;
+ var v9 = C.new;
+ Expect.equals(v7, v8);
+ Expect.equals(v7, v9);
+ Expect.equals(v8, v9);
+
+ Expect.notEquals(v1, v4);
+ Expect.notEquals(v2, v7);
+ Expect.notEquals(v5, v9);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A08_t01.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A08_t01.dart
new file mode 100644
index 0000000..ac746ae
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A08_t01.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion An instantiated tear-off is constant and canonicalized if the
+/// instantiating types are constant, and not even equal if they are not.
+///
+/// @description Checks that an instantiated tear-off is constant and
+/// canonicalized if the instantiating types are constant - test non-generic
+/// class
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class MyClass {
+ final a;
+ const MyClass(int i, int j) : a = (i + j);
+ const MyClass.constr() : a = 0;
+}
+
+main() {
+ var v1 = MyClass.new;
+ var v2 = MyClass.constr;
+
+ var c1 = v1();
+ var c2 = v1();
+ Expect.identical(c1, c2);
+
+ var c3 = v2();
+ var c4 = v2();
+ Expect.identical(c3, c4);
+
+ Expect.notEquals(c1, c3);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A08_t02.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A08_t02.dart
new file mode 100644
index 0000000..cf5a995
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A08_t02.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion An instantiated tear-off is constant and canonicalized if the
+/// instantiating types are constant, and not even equal if they are not.
+///
+/// @description Checks that An instantiated tear-off is constant and
+/// canonicalized if the instantiating types are constant - test generic class
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class MyClass<T> {
+ final a;
+ const MyClass(int i, int j) : a = (i + j);
+ const MyClass.constr() : a = 0;
+}
+
+main() {
+ var v1 = MyClass.new;
+ var v2 = MyClass.constr;
+
+ var c1 = v1();
+ var c2 = v1();
+ Expect.identical(c1, c2);
+
+ var c3 = v2();
+ var c4 = v2();
+ Expect.identical(c3, c4);
+
+ Expect.notEquals(c1, c3);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A08_t03.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A08_t03.dart
new file mode 100644
index 0000000..860b6ef
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A08_t03.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion An instantiated tear-off is constant and canonicalized if the
+/// instantiating types are constant, and not even equal if they are not.
+///
+/// @description Checks that an instantiated tear-off are not equal if the
+/// instantiating types are not constant - test non-generic class
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class MyClass {
+ int a;
+ MyClass(int i, int j) : a = (i + j);
+ MyClass.constr() : a = 0;
+}
+
+main() {
+ var v1 = MyClass.new;
+ var v2 = MyClass.constr;
+
+ var c1 = v1();
+ var c2 = v1();
+ Expect.notEquals(c1, c2);
+
+ var c3 = v2();
+ var c4 = v2();
+ Expect.notEquals(c3, c4);
+
+ Expect.notEquals(c1, c3);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_A08_t04.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_A08_t04.dart
new file mode 100644
index 0000000..1400abd
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_A08_t04.dart
@@ -0,0 +1,33 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion An instantiated tear-off is constant and canonicalized if the
+/// instantiating types are constant, and not even equal if they are not.
+///
+/// @description Checks that an instantiated tear-off are not equal if the
+/// instantiating types are not constant - test generic class
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class MyClass<T1 extends String, T2 extends num> {
+ int a;
+ MyClass(int i, int j) : a = (i + j);
+ MyClass.constr() : a = 0;
+}
+
+main() {
+ var v1 = MyClass.new;
+ var v2 = MyClass.constr;
+
+ var c1 = v1();
+ var c2 = v1();
+ Expect.notEquals(c1, c2);
+
+ var c3 = v2();
+ var c4 = v2();
+ Expect.notEquals(c3, c4);
+
+ Expect.notEquals(c1, c3);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_t09_A01.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_t09_A01.dart
new file mode 100644
index 0000000..5debb41
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_t09_A01.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion The static type of the named constructor tear-off expression is
+/// the same as the static type of the corresponding constructor function
+/// tear-off.
+///
+/// @description Checks that the static types of the constructor tear off
+/// expressions are the same - test non-generic class
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C {
+ int? i;
+ int? j;
+
+ C();
+ C.constr1(int i) {}
+ C.constr2(int i, String s, x) {}
+ C.constr3({int i=1, required j}) {}
+ C.constr4(this.i, this.j);
+}
+
+main() {
+ var v1 = C.new;
+ var v2 = (C.new);
+ Expect.equals(v1, v2);
+
+ var v3 = C.constr1;
+ var v4 = (C.constr1);
+ Expect.equals(v3, v4);
+
+ var v5 = C.constr2;
+ var v6 = (C.constr2);
+ Expect.equals(v5, v6);
+
+ var v7 = C.constr3;
+ var v8 = (C.constr3);
+ Expect.equals(v7, v8);
+
+ var v9 = C.constr4;
+ var v10 = (C.constr4);
+ Expect.equals(v9, v10);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/named_constructor_t09_A02.dart b/LanguageFeatures/Constructor-tear-offs/named_constructor_t09_A02.dart
new file mode 100644
index 0000000..80e8330
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/named_constructor_t09_A02.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// @assertion The static type of the named constructor tear-off expression is
+/// the same as the static type of the corresponding constructor function
+/// tear-off.
+///
+/// @description Checks that the static types of the constructor tear off
+/// expressions are the same - test generic class with default type arguments
+/// @author iarkh@unipro.ru
+
+import "../../Utils/expect.dart";
+
+class C<T> {
+ T? i;
+ T? j;
+
+ C();
+ C.constr1(T i) {}
+ C.constr2(int i, String s, x) {}
+ C.constr3({int i=1, required T j}) {}
+ C.constr4(this.i, this.j);
+}
+
+main() {
+ var v1 = C.new;
+ var v2 = (C.new);
+ Expect.equals(v1, v2);
+
+ var v3 = C.constr1;
+ var v4 = (C.constr1);
+ Expect.equals(v3, v4);
+
+ var v5 = C.constr2;
+ var v6 = (C.constr2);
+ Expect.equals(v5, v6);
+
+ var v7 = C.constr3;
+ var v8 = (C.constr3);
+ Expect.equals(v7, v8);
+
+ var v9 = C.constr4;
+ var v10 = (C.constr4);
+ Expect.equals(v9, v10);
+}