#1087. Resolving ambiguities tests added
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A01_t01.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A01_t01.dart
new file mode 100644
index 0000000..86d5802
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A01_t01.dart
@@ -0,0 +1,54 @@
+// 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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by '(' token. Test that f(a<b, c>(d)) is
+/// parsed as f((a<b, c>)(d))
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+
+String f(a, [b]) => "$a, $b";
+
+main() {
+ int a = 1;
+ int b = 2;
+ int c = 3;
+ int d = 4;
+ f(a<b,
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ c>(d));
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A01_t02.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A01_t02.dart
new file mode 100644
index 0000000..4f42b2d
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A01_t02.dart
@@ -0,0 +1,52 @@
+// 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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by '(' token. Test that f(a<b, c>(d)) is
+/// parsed as f((a<b, c>)(d))
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+import "../../Utils/expect.dart";
+
+String f(a, [b]) => "$a, $b";
+
+String a<T1, T2>(int x) {
+ return "a<$T1, $T2>($x)";
+}
+
+typedef b = int;
+typedef c = String;
+
+main() {
+ int d = 4;
+ Expect.equals("a<int, String>(4), null",f(a<b, c>(d)));
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A01_t03.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A01_t03.dart
new file mode 100644
index 0000000..dd76bc2
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A01_t03.dart
@@ -0,0 +1,55 @@
+// 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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by '(' token. Test that f(a<b, c>(d)) is
+/// parsed as f((a<b, c>)(d))
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+import "../../Utils/expect.dart";
+
+String f(a, [b]) => "$a, $b";
+
+class a<T1, T2> {
+ int x;
+ a(this.x);
+
+ String toString() => "a<$T1, $T2>($x)";
+}
+
+typedef b = int;
+typedef c = String;
+
+main() {
+ int d = 4;
+ Expect.equals("${a<b, c>(d)}, null",f(a<b, c>(d)));
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A02_t01.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A02_t01.dart
new file mode 100644
index 0000000..9cd2465
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A02_t01.dart
@@ -0,0 +1,53 @@
+// 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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by ')' token. Test that f(a<b, c>) is
+/// parsed as f((a<b, c>))
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+
+String f(a, [b]) => "$a, $b";
+
+main() {
+ int a = 1;
+ int b = 2;
+ int c = 3;
+ f(a<b,
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ c>);
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A02_t02.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A02_t02.dart
new file mode 100644
index 0000000..419d1e2
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A02_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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by ')' token. Test that f(a<b, c>) is
+/// parsed as f((a<b, c>)). Test generic function tear-off
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+import "../../Utils/expect.dart";
+
+String f(a, [b]) => "$a, $b";
+
+String a<T1, T2>(int x) {
+ return "a<$T1, $T2>($x)";
+}
+
+typedef b = int;
+typedef c = String;
+
+main() {
+ Expect.equals("${a<b, c>}, null", f(a<b, c>));
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A02_t03.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A02_t03.dart
new file mode 100644
index 0000000..93978cb
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A02_t03.dart
@@ -0,0 +1,54 @@
+// 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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by ')' token. Test that f(a<b, c>) is
+/// parsed as f((a<b, c>)). Test constructor tear-off
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+import "../../Utils/expect.dart";
+
+String f(a, [b]) => "$a, $b";
+
+class a<T1, T2> {
+ int x;
+ a(this.x);
+
+ String toString() => "a<$T1, $T2>($x)";
+}
+
+typedef b = int;
+typedef c = String;
+
+main() {
+ Expect.equals("${a<b, c>}, null",f(a<b, c>));
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A03_t01.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A03_t01.dart
new file mode 100644
index 0000000..6e4527a
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A03_t01.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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by ']' token. Test that [a<b, c>] is
+/// parsed as [(a<b, c>)]
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+
+main() {
+ int a = 1;
+ int b = 2;
+ int c = 3;
+ List<bool> l = [a<b,
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ c>];
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A03_t02.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A03_t02.dart
new file mode 100644
index 0000000..a5b09e7
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A03_t02.dart
@@ -0,0 +1,53 @@
+// 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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by ']' token. Test that [a<b, c>] is
+/// parsed as [(a<b, c>)]. Test generic function tear-off
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+import "../../Utils/expect.dart";
+
+String f(a, [b]) => "$a, $b";
+
+String a<T1, T2>(int x) {
+ return "a<$T1, $T2>($x)";
+}
+
+typedef b = int;
+typedef c = String;
+
+main() {
+ var x = a<b, c>;
+ Map f = {x: 42};
+ Expect.equals("42, null", f[a<b, c>]);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A03_t03.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A03_t03.dart
new file mode 100644
index 0000000..f7e917b
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A03_t03.dart
@@ -0,0 +1,56 @@
+// 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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by ']' token. Test that [a<b, c>] is
+/// parsed as [(a<b, c>)]. Test constructor tear-off
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+import "../../Utils/expect.dart";
+
+String f(a, [b]) => "$a, $b";
+
+class a<T1, T2> {
+ int x;
+ a(this.x);
+
+ String toString() => "a<$T1, $T2>($x)";
+}
+
+typedef b = int;
+typedef c = String;
+
+main() {
+ var x = a<b, c>;
+ Map f = {x: 42};
+ Expect.equals("42, null", f[a<b, c>]);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A04_t01.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A04_t01.dart
new file mode 100644
index 0000000..6c515f3
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A04_t01.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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by '}' token. Test that {a<b, c>} is
+/// parsed as {(a<b, c>)}
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+
+main() {
+ int a = 1;
+ int b = 2;
+ int c = 3;
+ Set<bool> s = {a<b,
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ c>};
+// ^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A04_t02.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A04_t02.dart
new file mode 100644
index 0000000..c8284da
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A04_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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by '}' token. Test that {a<b, c>} is
+/// parsed as {(a<b, c>)}. Test generic function tear-off
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+import "../../Utils/expect.dart";
+
+String a<T1, T2>(int x) {
+ return "a<$T1, $T2>($x)";
+}
+
+typedef b = int;
+typedef c = String;
+
+main() {
+ var x = {a<b, c>};
+ Expect.isTrue(x is Set);
+ Expect.equals(1, x.length);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A04_t03.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A04_t03.dart
new file mode 100644
index 0000000..90870e7
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A04_t03.dart
@@ -0,0 +1,56 @@
+// 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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by '}' token. Test that {a<b, c>} is
+/// parsed as {(a<b, c>)}. Test constructor tear-off
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+import "../../Utils/expect.dart";
+
+String f(a, [b]) => "$a, $b";
+
+class a<T1, T2> {
+ int x;
+ a(this.x);
+
+ String toString() => "a<$T1, $T2>($x)";
+}
+
+typedef b = int;
+typedef c = String;
+
+main() {
+ var x = {a<b, c>};
+ Expect.isTrue(x is Set);
+ Expect.equals(1, x.length);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A05_t01.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A05_t01.dart
new file mode 100644
index 0000000..43bbd40
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A05_t01.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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by ':' token. Test that a<b, c>: is
+/// parsed as (a<b, c>):
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+
+main() {
+ int a = 1;
+ int b = 2;
+ int c = 3;
+ Set<bool> s = {a<b,
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ c>:};
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A05_t02.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A05_t02.dart
new file mode 100644
index 0000000..fb1656c
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A05_t02.dart
@@ -0,0 +1,56 @@
+// 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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by ':' token. Test that a<b, c>: is
+/// parsed as (a<b, c>):. Test generic function tear-off
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+import "../../Utils/expect.dart";
+
+String a<T1, T2>(int x) {
+ return "a<$T1, $T2>($x)";
+}
+
+typedef b = int;
+typedef c = String;
+
+main() {
+ var x = a<b, c>;
+ var m = {a<b, c>: 42};
+ Expect.isTrue(m is Map);
+ Expect.equals(1, m.length);
+ Expect.equals(42, m[x]);
+
+ var y = 2 >= 1 ? a<b, c>: 42;
+ Expect.equals(x, y);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A05_t03.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A05_t03.dart
new file mode 100644
index 0000000..e15f4aa
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A05_t03.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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by ':' token. Test that a<b, c>: is
+/// parsed as (a<b, c>):. Test constructor tear-off
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+import "../../Utils/expect.dart";
+
+String f(a, [b]) => "$a, $b";
+
+class a<T1, T2> {
+ int x;
+ a(this.x);
+
+ String toString() => "a<$T1, $T2>($x)";
+}
+
+typedef b = int;
+typedef c = String;
+
+main() {
+ var x = a<b, c>;
+ var m = {a<b, c>: 42};
+ Expect.isTrue(m is Map);
+ Expect.equals(1, m.length);
+ Expect.equals(42, m[x]);
+
+ var y = 2 >= 1 ? a<b, c>: 42;
+ Expect.equals(x, y);
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A06_t01.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A06_t01.dart
new file mode 100644
index 0000000..d8600b0
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A06_t01.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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by ';' token. Test that a<b, c>; is
+/// parsed as (a<b, c>);
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+
+main() {
+ int a = 1;
+ int b = 2;
+ int c = 3;
+ var x = a<b,
+// ^^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+ c>;
+// ^^^
+// [analyzer] unspecified
+// [cfe] unspecified
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A06_t02.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A06_t02.dart
new file mode 100644
index 0000000..81e8514
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A06_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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by ';' token. Test that a<b, c>; is
+/// parsed as (a<b, c>);. Test generic function tear-off
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+import "../../Utils/expect.dart";
+
+String a<T1, T2>(int x) {
+ return "a<$T1, $T2>($x)";
+}
+
+typedef b = int;
+typedef c = String;
+
+main() {
+ var x = a<b, c>;
+ Expect.isTrue(x is Function);
+ Expect.equals("a<int, String>(42)", x(42));
+}
diff --git a/LanguageFeatures/Constructor-tear-offs/ambiguities_A06_t03.dart b/LanguageFeatures/Constructor-tear-offs/ambiguities_A06_t03.dart
new file mode 100644
index 0000000..4387acc
--- /dev/null
+++ b/LanguageFeatures/Constructor-tear-offs/ambiguities_A06_t03.dart
@@ -0,0 +1,56 @@
+// 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 This new syntax also introduces new ambiguities in the grammar,
+/// similar to the one we introduced with generic functions. Examples include:
+///
+/// f(a<b,c>(d)); // Existing ambiguity, resolved to a generic method call.
+/// f(x.a<b,c>[d]); // f((x.a<b, c>)[d]) or f((x.a < b), (c > [d]))
+/// f(x.a<b,c>-d); // f((x.a<b, c>)-d) or f((x.a < b), (c > -d]))
+/// The x.a<b,c> can be an explicitly instantiated generic function tear-off or
+/// an explicitly instantiated type literal named using a prefix, which is new.
+/// While neither type objects nor functions declare operator- or operator[],
+/// such could be added using extension methods.
+///
+/// We will disambiguate such situations heuristically based on the token
+/// following the >. In the existing ambiguity we treat ( as a sign that it's a
+/// generic invocation. If the next character is one which cannot start a new
+/// expression (and thereby be the second operand of a > operator), the prior
+/// tokens is parsed as an explicit instantiation. If the token can start a new
+/// expression, then we make a choice depending on what we consider the most
+/// likely intention (that's specifically - and [ in the examples above).
+///
+/// The look-ahead tokens which force the prior tokens to be type arguments are:
+///
+/// ( ) ] } : ; , . ? == != .. ?. ?? ?..
+///
+/// & | ^ + * % / ~/
+///
+// Any other token following the ambiguous > will make the prior tokens be
+// parsed as comma separated < and > operator invocations.
+///
+/// @description Checks disambiguate by ';' token. Test that a<b, c>; is
+/// parsed as (a<b, c>);. Test constructor tear-off
+/// @author sgrekhov@unipro.ru
+
+// SharedOptions=--enable-experiment=constructor-tearoffs
+import "../../Utils/expect.dart";
+
+String f(a, [b]) => "$a, $b";
+
+class a<T1, T2> {
+ int x;
+ a(this.x);
+
+ String toString() => "a<$T1, $T2>($x)";
+}
+
+typedef b = int;
+typedef c = String;
+
+main() {
+ var x = a<b, c>;
+ Expect.isTrue(x is Type);
+ Expect.equals("a<int, String>(42)", x(42).toString());
+}