Version 2.14.0-366.0.dev

Merge commit 'ac137cf40ff1d5da95ec8e99653538b2ed6eef5b' into 'dev'
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 633f674..93fb9a8 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -1053,8 +1053,12 @@
       // To report errors on the first definition of a constructor, we need to
       // iterate until that last element.
       ConstructorBuilder earliest = constructorBuilder;
-      while (earliest.next != null) {
-        earliest = earliest.next as ConstructorBuilder;
+      Builder earliestBuilder = constructorBuilder;
+      while (earliestBuilder.next != null) {
+        earliestBuilder = earliestBuilder.next!;
+        if (earliestBuilder is ConstructorBuilder) {
+          earliest = earliestBuilder;
+        }
       }
 
       bool isRedirecting = false;
diff --git a/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart b/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart
index 6d8b22b..8650911 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart
+++ b/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart
@@ -5,5 +5,10 @@
 T func<T>(T value) => value;
 var funcValue = func;
 int Function(int) f = funcValue.call; // Disallowed!
+int Function(int) g = funcValue.call<int>; // Disallowed!
+
+test(Function f) {
+  int Function(int) g = f.call<int>; // Disallowed!
+}
 
 main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.strong.expect
index bdc66d1..fe25279 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.strong.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.strong.expect
@@ -6,6 +6,12 @@
 // int Function(int) f = funcValue.call; // Disallowed!
 //                                 ^
 //
+// pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart:11:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
+//  - 'Function' is from 'dart:core'.
+// Try changing the operand or remove the type arguments.
+//   int Function(int) g = f.call<int>; // Disallowed!
+//                               ^
+//
 import self as self;
 import "dart:core" as core;
 
@@ -13,8 +19,16 @@
 static field (core::int) → core::int f = let final Never #t1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart:7:33: Error: A value of type 'T Function<T>(T)' can't be assigned to a variable of type 'int Function(int)'.
 int Function(int) f = funcValue.call; // Disallowed!
                                 ^" in self::funcValue.call as{TypeError,ForNonNullableByDefault} (core::int) → core::int;
+static field (core::int) → core::int g = self::funcValue.call<core::int>;
 static method func<T extends core::Object? = dynamic>(self::func::T% value) → self::func::T%
   return value;
+static method test(core::Function f) → dynamic {
+  (core::int) → core::int g = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart:11:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
+ - 'Function' is from 'dart:core'.
+Try changing the operand or remove the type arguments.
+  int Function(int) g = f.call<int>; // Disallowed!
+                              ^";
+}
 static method main() → dynamic {}
 
 constants  {
diff --git a/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.textual_outline.expect
index 26c075f..6488494 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.textual_outline.expect
@@ -1,4 +1,6 @@
 T func<T>(T value) => value;
 var funcValue = func;
 int Function(int) f = funcValue.call;
+int Function(int) g = funcValue.call<int>;
+test(Function f) {}
 main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.weak.expect
index bdc66d1..fe25279 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.weak.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.weak.expect
@@ -6,6 +6,12 @@
 // int Function(int) f = funcValue.call; // Disallowed!
 //                                 ^
 //
+// pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart:11:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
+//  - 'Function' is from 'dart:core'.
+// Try changing the operand or remove the type arguments.
+//   int Function(int) g = f.call<int>; // Disallowed!
+//                               ^
+//
 import self as self;
 import "dart:core" as core;
 
@@ -13,8 +19,16 @@
 static field (core::int) → core::int f = let final Never #t1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart:7:33: Error: A value of type 'T Function<T>(T)' can't be assigned to a variable of type 'int Function(int)'.
 int Function(int) f = funcValue.call; // Disallowed!
                                 ^" in self::funcValue.call as{TypeError,ForNonNullableByDefault} (core::int) → core::int;
+static field (core::int) → core::int g = self::funcValue.call<core::int>;
 static method func<T extends core::Object? = dynamic>(self::func::T% value) → self::func::T%
   return value;
+static method test(core::Function f) → dynamic {
+  (core::int) → core::int g = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart:11:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
+ - 'Function' is from 'dart:core'.
+Try changing the operand or remove the type arguments.
+  int Function(int) g = f.call<int>; // Disallowed!
+                              ^";
+}
 static method main() → dynamic {}
 
 constants  {
diff --git a/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.weak.outline.expect
index cce6eb8..fc89fd2 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/call_instantiation.dart.weak.outline.expect
@@ -4,7 +4,10 @@
 
 static field <T extends core::Object? = dynamic>(T%) → T% funcValue;
 static field (core::int) → core::int f;
+static field (core::int) → core::int g;
 static method func<T extends core::Object? = dynamic>(self::func::T% value) → self::func::T%
   ;
+static method test(core::Function f) → dynamic
+  ;
 static method main() → dynamic
   ;
diff --git a/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart
new file mode 100644
index 0000000..50c03ac
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart
@@ -0,0 +1,10 @@
+// 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.
+
+test1(dynamic x) => x.foo<int>; // Error.
+test2(Never x) => x.foo<int>; // Error.
+test3(dynamic x) => x.toString<int>; // Error.
+test4(Never x) => x.toString<int>; // Error.
+
+main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.strong.expect
new file mode 100644
index 0000000..ee9aed5
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.strong.expect
@@ -0,0 +1,47 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
+// Try changing the operand or remove the type arguments.
+// test1(dynamic x) => x.foo<int>; // Error.
+//                          ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+// Try changing the operand or remove the type arguments.
+// test2(Never x) => x.foo<int>; // Error.
+//                        ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
+// Try changing the operand or remove the type arguments.
+// test3(dynamic x) => x.toString<int>; // Error.
+//                               ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+// Try changing the operand or remove the type arguments.
+// test4(Never x) => x.toString<int>; // Error.
+//                             ^
+//
+import self as self;
+
+static method test1(dynamic x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
+Try changing the operand or remove the type arguments.
+test1(dynamic x) => x.foo<int>; // Error.
+                         ^";
+static method test2(Never x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+Try changing the operand or remove the type arguments.
+test2(Never x) => x.foo<int>; // Error.
+                       ^";
+static method test3(dynamic x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
+Try changing the operand or remove the type arguments.
+test3(dynamic x) => x.toString<int>; // Error.
+                              ^";
+static method test4(Never x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+Try changing the operand or remove the type arguments.
+test4(Never x) => x.toString<int>; // Error.
+                            ^";
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.strong.transformed.expect
new file mode 100644
index 0000000..ee9aed5
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.strong.transformed.expect
@@ -0,0 +1,47 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
+// Try changing the operand or remove the type arguments.
+// test1(dynamic x) => x.foo<int>; // Error.
+//                          ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+// Try changing the operand or remove the type arguments.
+// test2(Never x) => x.foo<int>; // Error.
+//                        ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
+// Try changing the operand or remove the type arguments.
+// test3(dynamic x) => x.toString<int>; // Error.
+//                               ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+// Try changing the operand or remove the type arguments.
+// test4(Never x) => x.toString<int>; // Error.
+//                             ^
+//
+import self as self;
+
+static method test1(dynamic x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
+Try changing the operand or remove the type arguments.
+test1(dynamic x) => x.foo<int>; // Error.
+                         ^";
+static method test2(Never x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+Try changing the operand or remove the type arguments.
+test2(Never x) => x.foo<int>; // Error.
+                       ^";
+static method test3(dynamic x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
+Try changing the operand or remove the type arguments.
+test3(dynamic x) => x.toString<int>; // Error.
+                              ^";
+static method test4(Never x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+Try changing the operand or remove the type arguments.
+test4(Never x) => x.toString<int>; // Error.
+                            ^";
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.textual_outline.expect
new file mode 100644
index 0000000..8143249
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.textual_outline.expect
@@ -0,0 +1,5 @@
+test1(dynamic x) => x.foo<int>;
+test2(Never x) => x.foo<int>;
+test3(dynamic x) => x.toString<int>;
+test4(Never x) => x.toString<int>;
+main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.weak.expect
new file mode 100644
index 0000000..ee9aed5
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.weak.expect
@@ -0,0 +1,47 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
+// Try changing the operand or remove the type arguments.
+// test1(dynamic x) => x.foo<int>; // Error.
+//                          ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+// Try changing the operand or remove the type arguments.
+// test2(Never x) => x.foo<int>; // Error.
+//                        ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
+// Try changing the operand or remove the type arguments.
+// test3(dynamic x) => x.toString<int>; // Error.
+//                               ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+// Try changing the operand or remove the type arguments.
+// test4(Never x) => x.toString<int>; // Error.
+//                             ^
+//
+import self as self;
+
+static method test1(dynamic x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
+Try changing the operand or remove the type arguments.
+test1(dynamic x) => x.foo<int>; // Error.
+                         ^";
+static method test2(Never x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+Try changing the operand or remove the type arguments.
+test2(Never x) => x.foo<int>; // Error.
+                       ^";
+static method test3(dynamic x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
+Try changing the operand or remove the type arguments.
+test3(dynamic x) => x.toString<int>; // Error.
+                              ^";
+static method test4(Never x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+Try changing the operand or remove the type arguments.
+test4(Never x) => x.toString<int>; // Error.
+                            ^";
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.weak.outline.expect
new file mode 100644
index 0000000..a0dbfbd
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.weak.outline.expect
@@ -0,0 +1,13 @@
+library /*isNonNullableByDefault*/;
+import self as self;
+
+static method test1(dynamic x) → dynamic
+  ;
+static method test2(Never x) → dynamic
+  ;
+static method test3(dynamic x) → dynamic
+  ;
+static method test4(Never x) → dynamic
+  ;
+static method main() → dynamic
+  ;
diff --git a/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.weak.transformed.expect
new file mode 100644
index 0000000..ee9aed5
--- /dev/null
+++ b/pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart.weak.transformed.expect
@@ -0,0 +1,47 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
+// Try changing the operand or remove the type arguments.
+// test1(dynamic x) => x.foo<int>; // Error.
+//                          ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+// Try changing the operand or remove the type arguments.
+// test2(Never x) => x.foo<int>; // Error.
+//                        ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
+// Try changing the operand or remove the type arguments.
+// test3(dynamic x) => x.toString<int>; // Error.
+//                               ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+// Try changing the operand or remove the type arguments.
+// test4(Never x) => x.toString<int>; // Error.
+//                             ^
+//
+import self as self;
+
+static method test1(dynamic x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:5:26: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
+Try changing the operand or remove the type arguments.
+test1(dynamic x) => x.foo<int>; // Error.
+                         ^";
+static method test2(Never x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:6:24: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+Try changing the operand or remove the type arguments.
+test2(Never x) => x.foo<int>; // Error.
+                       ^";
+static method test3(dynamic x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:7:31: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String Function()'.
+Try changing the operand or remove the type arguments.
+test3(dynamic x) => x.toString<int>; // Error.
+                              ^";
+static method test4(Never x) → dynamic
+  return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/dynamic_explicit_instantiation.dart:8:29: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
+Try changing the operand or remove the type arguments.
+test4(Never x) => x.toString<int>; // Error.
+                            ^";
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart
index 52f4e5c..fe45034 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart
+++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart
@@ -20,4 +20,28 @@
   D(); // Error.
 }
 
+class E1 {
+  E1._();
+  E1();
+  factory E1.new() => E1._(); // Error.
+}
+
+class E2 {
+  E2._();
+  factory E2.new() => E2._(); // Error.
+  E2();
+}
+
+class E3 {
+  E3._();
+  E3();
+  factory E3.new() = E3._; // Error.
+}
+
+class E4 {
+  E4._();
+  factory E4.new() = E4._;
+  E4(); // Error.
+}
+
 main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.expect
index 7e82eb9..331bcc5 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.expect
@@ -16,6 +16,34 @@
 //   D.new();
 //   ^
 //
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:26:11: Error: 'E1' is already declared in this scope.
+//   factory E1.new() => E1._(); // Error.
+//           ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:25:3: Context: Previous declaration of 'E1'.
+//   E1();
+//   ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:32:3: Error: 'E2' is already declared in this scope.
+//   E2();
+//   ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:31:11: Context: Previous declaration of 'E2'.
+//   factory E2.new() => E2._(); // Error.
+//           ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:38:11: Error: 'E3' is already declared in this scope.
+//   factory E3.new() = E3._; // Error.
+//           ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:37:3: Context: Previous declaration of 'E3'.
+//   E3();
+//   ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:44:3: Error: 'E4' is already declared in this scope.
+//   E4(); // Error.
+//   ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:43:11: Context: Previous declaration of 'E4'.
+//   factory E4.new() = E4._;
+//           ^^
+//
 import self as self;
 import "dart:core" as core;
 
@@ -39,4 +67,35 @@
     : super core::Object::•()
     ;
 }
+class E1 extends core::Object {
+  constructor _() → self::E1
+    : super core::Object::•()
+    ;
+  constructor •() → self::E1
+    : super core::Object::•()
+    ;
+}
+class E2 extends core::Object {
+  constructor _() → self::E2
+    : super core::Object::•()
+    ;
+  static factory •() → self::E2
+    return new self::E2::_();
+}
+class E3 extends core::Object {
+  constructor _() → self::E3
+    : super core::Object::•()
+    ;
+  constructor •() → self::E3
+    : super core::Object::•()
+    ;
+}
+class E4 extends core::Object {
+  static final field dynamic _redirecting# = <dynamic>[self::E4::•]/*isLegacy*/;
+  constructor _() → self::E4
+    : super core::Object::•()
+    ;
+  static factory •() → self::E4
+    let dynamic #redirecting_factory = self::E4::_ in invalid-expression;
+}
 static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.transformed.expect
index 7e82eb9..fdbc0b6 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.strong.transformed.expect
@@ -16,6 +16,34 @@
 //   D.new();
 //   ^
 //
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:26:11: Error: 'E1' is already declared in this scope.
+//   factory E1.new() => E1._(); // Error.
+//           ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:25:3: Context: Previous declaration of 'E1'.
+//   E1();
+//   ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:32:3: Error: 'E2' is already declared in this scope.
+//   E2();
+//   ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:31:11: Context: Previous declaration of 'E2'.
+//   factory E2.new() => E2._(); // Error.
+//           ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:38:11: Error: 'E3' is already declared in this scope.
+//   factory E3.new() = E3._; // Error.
+//           ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:37:3: Context: Previous declaration of 'E3'.
+//   E3();
+//   ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:44:3: Error: 'E4' is already declared in this scope.
+//   E4(); // Error.
+//   ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:43:11: Context: Previous declaration of 'E4'.
+//   factory E4.new() = E4._;
+//           ^^
+//
 import self as self;
 import "dart:core" as core;
 
@@ -39,4 +67,35 @@
     : super core::Object::•()
     ;
 }
+class E1 extends core::Object {
+  constructor _() → self::E1
+    : super core::Object::•()
+    ;
+  constructor •() → self::E1
+    : super core::Object::•()
+    ;
+}
+class E2 extends core::Object {
+  constructor _() → self::E2
+    : super core::Object::•()
+    ;
+  static factory •() → self::E2
+    return new self::E2::_();
+}
+class E3 extends core::Object {
+  constructor _() → self::E3
+    : super core::Object::•()
+    ;
+  constructor •() → self::E3
+    : super core::Object::•()
+    ;
+}
+class E4 extends core::Object {
+  static final field dynamic _redirecting# = <dynamic>[self::E4::•]/*isLegacy*/;
+  constructor _() → self::E4
+    : super core::Object::•()
+    ;
+  static factory •() → self::E4
+    let Never #redirecting_factory = self::E4::_ in invalid-expression;
+}
 static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline.expect
index e970626..d6ac347 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.textual_outline.expect
@@ -12,4 +12,24 @@
   D.new();
   D();
 }
+class E1 {
+  E1._();
+  E1();
+  factory E1.new() => E1._();
+}
+class E2 {
+  E2._();
+  factory E2.new() => E2._();
+  E2();
+}
+class E3 {
+  E3._();
+  E3();
+  factory E3.new() = E3._;
+}
+class E4 {
+  E4._();
+  factory E4.new() = E4._;
+  E4();
+}
 main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.expect
index 7e82eb9..331bcc5 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.expect
@@ -16,6 +16,34 @@
 //   D.new();
 //   ^
 //
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:26:11: Error: 'E1' is already declared in this scope.
+//   factory E1.new() => E1._(); // Error.
+//           ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:25:3: Context: Previous declaration of 'E1'.
+//   E1();
+//   ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:32:3: Error: 'E2' is already declared in this scope.
+//   E2();
+//   ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:31:11: Context: Previous declaration of 'E2'.
+//   factory E2.new() => E2._(); // Error.
+//           ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:38:11: Error: 'E3' is already declared in this scope.
+//   factory E3.new() = E3._; // Error.
+//           ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:37:3: Context: Previous declaration of 'E3'.
+//   E3();
+//   ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:44:3: Error: 'E4' is already declared in this scope.
+//   E4(); // Error.
+//   ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:43:11: Context: Previous declaration of 'E4'.
+//   factory E4.new() = E4._;
+//           ^^
+//
 import self as self;
 import "dart:core" as core;
 
@@ -39,4 +67,35 @@
     : super core::Object::•()
     ;
 }
+class E1 extends core::Object {
+  constructor _() → self::E1
+    : super core::Object::•()
+    ;
+  constructor •() → self::E1
+    : super core::Object::•()
+    ;
+}
+class E2 extends core::Object {
+  constructor _() → self::E2
+    : super core::Object::•()
+    ;
+  static factory •() → self::E2
+    return new self::E2::_();
+}
+class E3 extends core::Object {
+  constructor _() → self::E3
+    : super core::Object::•()
+    ;
+  constructor •() → self::E3
+    : super core::Object::•()
+    ;
+}
+class E4 extends core::Object {
+  static final field dynamic _redirecting# = <dynamic>[self::E4::•]/*isLegacy*/;
+  constructor _() → self::E4
+    : super core::Object::•()
+    ;
+  static factory •() → self::E4
+    let dynamic #redirecting_factory = self::E4::_ in invalid-expression;
+}
 static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.outline.expect
index 47a2971..34ae47c 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.outline.expect
@@ -16,6 +16,34 @@
 //   D.new();
 //   ^
 //
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:26:11: Error: 'E1' is already declared in this scope.
+//   factory E1.new() => E1._(); // Error.
+//           ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:25:3: Context: Previous declaration of 'E1'.
+//   E1();
+//   ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:32:3: Error: 'E2' is already declared in this scope.
+//   E2();
+//   ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:31:11: Context: Previous declaration of 'E2'.
+//   factory E2.new() => E2._(); // Error.
+//           ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:38:11: Error: 'E3' is already declared in this scope.
+//   factory E3.new() = E3._; // Error.
+//           ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:37:3: Context: Previous declaration of 'E3'.
+//   E3();
+//   ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:44:3: Error: 'E4' is already declared in this scope.
+//   E4(); // Error.
+//   ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:43:11: Context: Previous declaration of 'E4'.
+//   factory E4.new() = E4._;
+//           ^^
+//
 import self as self;
 import "dart:core" as core;
 
@@ -35,5 +63,30 @@
   constructor •() → self::D
     ;
 }
+class E1 extends core::Object {
+  constructor _() → self::E1
+    ;
+  constructor •() → self::E1
+    ;
+}
+class E2 extends core::Object {
+  constructor _() → self::E2
+    ;
+  static factory •() → self::E2
+    ;
+}
+class E3 extends core::Object {
+  constructor _() → self::E3
+    ;
+  constructor •() → self::E3
+    ;
+}
+class E4 extends core::Object {
+  static final field dynamic _redirecting# = <dynamic>[self::E4::•]/*isLegacy*/;
+  constructor _() → self::E4
+    ;
+  static factory •() → self::E4
+    let dynamic #redirecting_factory = self::E4::_ in invalid-expression;
+}
 static method main() → dynamic
   ;
diff --git a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.transformed.expect
index 7e82eb9..fdbc0b6 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart.weak.transformed.expect
@@ -16,6 +16,34 @@
 //   D.new();
 //   ^
 //
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:26:11: Error: 'E1' is already declared in this scope.
+//   factory E1.new() => E1._(); // Error.
+//           ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:25:3: Context: Previous declaration of 'E1'.
+//   E1();
+//   ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:32:3: Error: 'E2' is already declared in this scope.
+//   E2();
+//   ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:31:11: Context: Previous declaration of 'E2'.
+//   factory E2.new() => E2._(); // Error.
+//           ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:38:11: Error: 'E3' is already declared in this scope.
+//   factory E3.new() = E3._; // Error.
+//           ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:37:3: Context: Previous declaration of 'E3'.
+//   E3();
+//   ^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:44:3: Error: 'E4' is already declared in this scope.
+//   E4(); // Error.
+//   ^^
+// pkg/front_end/testcases/constructor_tearoffs/explicit_new_as_unnamed.dart:43:11: Context: Previous declaration of 'E4'.
+//   factory E4.new() = E4._;
+//           ^^
+//
 import self as self;
 import "dart:core" as core;
 
@@ -39,4 +67,35 @@
     : super core::Object::•()
     ;
 }
+class E1 extends core::Object {
+  constructor _() → self::E1
+    : super core::Object::•()
+    ;
+  constructor •() → self::E1
+    : super core::Object::•()
+    ;
+}
+class E2 extends core::Object {
+  constructor _() → self::E2
+    : super core::Object::•()
+    ;
+  static factory •() → self::E2
+    return new self::E2::_();
+}
+class E3 extends core::Object {
+  constructor _() → self::E3
+    : super core::Object::•()
+    ;
+  constructor •() → self::E3
+    : super core::Object::•()
+    ;
+}
+class E4 extends core::Object {
+  static final field dynamic _redirecting# = <dynamic>[self::E4::•]/*isLegacy*/;
+  constructor _() → self::E4
+    : super core::Object::•()
+    ;
+  static factory •() → self::E4
+    let Never #redirecting_factory = self::E4::_ in invalid-expression;
+}
 static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue46745.dart b/pkg/front_end/testcases/general/issue46745.dart
new file mode 100644
index 0000000..8eb5b1b
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue46745.dart
@@ -0,0 +1,11 @@
+// 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.
+
+class A {
+  A._();
+  factory A.foo() => A._();
+  A.foo();
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue46745.dart.textual_outline.expect b/pkg/front_end/testcases/general/issue46745.dart.textual_outline.expect
new file mode 100644
index 0000000..59dd347
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue46745.dart.textual_outline.expect
@@ -0,0 +1,7 @@
+class A {
+  A._();
+  factory A.foo() => A._();
+  A.foo();
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue46745.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/general/issue46745.dart.textual_outline_modelled.expect
new file mode 100644
index 0000000..77788ac
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue46745.dart.textual_outline_modelled.expect
@@ -0,0 +1,7 @@
+class A {
+  A._();
+  A.foo();
+  factory A.foo() => A._();
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/general/issue46745.dart.weak.expect b/pkg/front_end/testcases/general/issue46745.dart.weak.expect
new file mode 100644
index 0000000..a375575
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue46745.dart.weak.expect
@@ -0,0 +1,22 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue46745.dart:8:3: Error: 'A.foo' is already declared in this scope.
+//   A.foo();
+//   ^^^^^
+// pkg/front_end/testcases/general/issue46745.dart:7:11: Context: Previous declaration of 'A.foo'.
+//   factory A.foo() => A._();
+//           ^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+  constructor _() → self::A
+    : super core::Object::•()
+    ;
+  static factory foo() → self::A
+    return new self::A::_();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/general/issue46745.dart.weak.outline.expect b/pkg/front_end/testcases/general/issue46745.dart.weak.outline.expect
new file mode 100644
index 0000000..eb5a0eb
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue46745.dart.weak.outline.expect
@@ -0,0 +1,22 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue46745.dart:8:3: Error: 'A.foo' is already declared in this scope.
+//   A.foo();
+//   ^^^^^
+// pkg/front_end/testcases/general/issue46745.dart:7:11: Context: Previous declaration of 'A.foo'.
+//   factory A.foo() => A._();
+//           ^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+  constructor _() → self::A
+    ;
+  static factory foo() → self::A
+    ;
+}
+static method main() → dynamic
+  ;
diff --git a/pkg/front_end/testcases/general/issue46745.dart.weak.transformed.expect b/pkg/front_end/testcases/general/issue46745.dart.weak.transformed.expect
new file mode 100644
index 0000000..a375575
--- /dev/null
+++ b/pkg/front_end/testcases/general/issue46745.dart.weak.transformed.expect
@@ -0,0 +1,22 @@
+library /*isNonNullableByDefault*/;
+//
+// Problems in library:
+//
+// pkg/front_end/testcases/general/issue46745.dart:8:3: Error: 'A.foo' is already declared in this scope.
+//   A.foo();
+//   ^^^^^
+// pkg/front_end/testcases/general/issue46745.dart:7:11: Context: Previous declaration of 'A.foo'.
+//   factory A.foo() => A._();
+//           ^^^^^
+//
+import self as self;
+import "dart:core" as core;
+
+class A extends core::Object {
+  constructor _() → self::A
+    : super core::Object::•()
+    ;
+  static factory foo() → self::A
+    return new self::A::_();
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status
index face729..130bcfb 100644
--- a/pkg/front_end/testcases/strong.status
+++ b/pkg/front_end/testcases/strong.status
@@ -8,6 +8,7 @@
 
 dart2js/late_statics: SemiFuzzFailure # dartbug.com/45854
 
+constructor_tearoffs/call_instantiation: TypeCheckError
 constructor_tearoffs/const_tear_off: RuntimeError
 constructor_tearoffs/inferred_constructor_tear_off: RuntimeError
 constructor_tearoffs/inferred_non_proper_rename: RuntimeError
diff --git a/pkg/front_end/testcases/text_serialization.status b/pkg/front_end/testcases/text_serialization.status
index f52deaa..bf8ca1a 100644
--- a/pkg/front_end/testcases/text_serialization.status
+++ b/pkg/front_end/testcases/text_serialization.status
@@ -6,6 +6,7 @@
 # the round trip for Kernel textual serialization where the initial binary
 # Kernel files are produced by compiling Dart code via Fasta.
 
+constructor_tearoffs/call_instantiation: TypeCheckError
 constructor_tearoffs/const_tear_off: RuntimeError
 constructor_tearoffs/inferred_constructor_tear_off: RuntimeError
 constructor_tearoffs/inferred_non_proper_rename: RuntimeError
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status
index 578e809..2029725 100644
--- a/pkg/front_end/testcases/textual_outline.status
+++ b/pkg/front_end/testcases/textual_outline.status
@@ -23,7 +23,9 @@
 const_functions/const_functions_const_ctor: FormatterCrash
 const_functions/const_functions_const_ctor_error: FormatterCrash
 const_functions/const_functions_const_factory: FormatterCrash
+constructor_tearoffs/call_instantiation: FormatterCrash
 constructor_tearoffs/const_tear_off: FormatterCrash
+constructor_tearoffs/dynamic_explicit_instantiation: FormatterCrash
 constructor_tearoffs/explicit_instantiation_errors: FormatterCrash
 constructor_tearoffs/explicit_new_as_unnamed: FormatterCrash
 constructor_tearoffs/generic_tearoff_with_context: FormatterCrash
diff --git a/pkg/front_end/testcases/weak.status b/pkg/front_end/testcases/weak.status
index d45056d..f6c24b7 100644
--- a/pkg/front_end/testcases/weak.status
+++ b/pkg/front_end/testcases/weak.status
@@ -11,6 +11,7 @@
 regress/utf_16_le_content.crash: SemiFuzzCrash
 dart2js/late_statics: SemiFuzzFailure # dartbug.com/45854
 
+constructor_tearoffs/call_instantiation: TypeCheckError
 constructor_tearoffs/const_tear_off: RuntimeError
 constructor_tearoffs/inferred_constructor_tear_off: RuntimeError
 constructor_tearoffs/inferred_non_proper_rename: RuntimeError
diff --git a/tools/VERSION b/tools/VERSION
index ea36d5e..e61aabf 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
 MAJOR 2
 MINOR 14
 PATCH 0
-PRERELEASE 365
+PRERELEASE 366
 PRERELEASE_PATCH 0
\ No newline at end of file