Version 2.14.0-211.0.dev
Merge commit '5c0b3877e35166e1d79f39ba8b700729a5be00e0' into 'dev'
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/extension_member_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/extension_member_contributor.dart
index 036786e..cfbdb7f 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/extension_member_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/extension_member_contributor.dart
@@ -31,6 +31,10 @@
var expression = request.dotTarget;
if (expression == null) {
+ if (!request.includeIdentifiers) {
+ return;
+ }
+
var classOrMixin = request.target.containingNode
.thisOrAncestorOfType<ClassOrMixinDeclaration>();
if (classOrMixin != null) {
diff --git a/pkg/analysis_server/test/domain_completion_test.dart b/pkg/analysis_server/test/domain_completion_test.dart
index 08d3056..fd933fa 100644
--- a/pkg/analysis_server/test/domain_completion_test.dart
+++ b/pkg/analysis_server/test/domain_completion_test.dart
@@ -538,6 +538,23 @@
expect(suggestions, isEmpty);
}
+ Future<void> test_inDartDoc3() async {
+ addTestFile('''
+class MyClass {
+ /// ^
+ void foo() {}
+
+ void bar() {}
+}
+
+extension MyClassExtension on MyClass {
+ void baz() {}
+}
+ ''');
+ await getSuggestions();
+ expect(suggestions, isEmpty);
+ }
+
Future<void> test_inDartDoc_reference1() async {
newFile('/testA.dart', content: '''
part of libA;
@@ -564,6 +581,24 @@
assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'main');
}
+ Future<void> test_inDartDoc_reference3() async {
+ addTestFile('''
+class MyClass {
+ /// [^]
+ void foo() {}
+
+ void bar() {}
+}
+
+extension MyClassExtension on MyClass {
+ void baz() {}
+}
+ ''');
+ await getSuggestions();
+ assertHasResult(CompletionSuggestionKind.IDENTIFIER, 'bar');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'baz');
+ }
+
Future<void> test_inherited() {
addTestFile('''
class A {
diff --git a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
index 91da0d0..8736d5a 100644
--- a/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_library_builder.dart
@@ -3577,7 +3577,7 @@
// limitation of Kernel.
if (typeParameter != null &&
typeParameter.fileOffset != -1 &&
- typeParameter.parent != null) {
+ typeParameter.location != null) {
// It looks like when parameters come from patch files, they don't
// have a reportable location.
(context ??= <LocatedMessage>[]).add(
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart
index da236c6..ff2f3fe4 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart
@@ -5,9 +5,17 @@
class A<X> {
A.foo1(X x) {}
A.foo2(X x, int y) {}
+ A();
}
-A<X> Function<X>(X) bar1() => A.foo1; // Ok.
-A<X> Function<X>(X) bar2() => A.foo2; // Error.
+A<X> Function<X>(X) test1() => A.foo1; // Ok.
+A<X> Function<X>(X) test2() => A.foo2; // Error.
+A<X> Function<X>(X) test3() => A.new; // Error.
+A<X> Function<X>(X) test4() => A<int>.new; // Error.
+A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.strong.expect
index 95d69d7..31c797b 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.strong.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.strong.expect
@@ -2,13 +2,71 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:10:33: Error: Getter not found: 'foo1'.
-// A<X> Function<X>(X) bar1() => A.foo1; // Ok.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:34: Error: Getter not found: 'foo1'.
+// A<X> Function<X>(X) test1() => A.foo1; // Ok.
+// ^^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:33: Error: Getter not found: 'foo2'.
-// A<X> Function<X>(X) bar2() => A.foo2; // Error.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:12:34: Error: Getter not found: 'foo2'.
+// A<X> Function<X>(X) test2() => A.foo2; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:34: Error: Getter not found: 'new'.
+// A<X> Function<X>(X) test3() => A.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test4() => A<int>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:39: Error: Getter not found: 'new'.
+// A<X> Function<X>(X) test4() => A<int>.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:15:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:15:47: Error: Getter not found: 'new'.
+// A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:16:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:16:39: Error: Getter not found: 'foo1'.
+// A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:17:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:17:47: Error: Getter not found: 'foo1'.
+// A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:18:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:18:39: Error: Getter not found: 'foo2'.
+// A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:19:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:19:47: Error: Getter not found: 'foo2'.
+// A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
+// ^^^^
//
import self as self;
import "dart:core" as core;
@@ -18,13 +76,44 @@
: super core::Object::•() {}
constructor foo2(self::A::X% x, core::int y) → self::A<self::A::X%>
: super core::Object::•() {}
+ constructor •() → self::A<self::A::X%>
+ : super core::Object::•()
+ ;
}
-static method bar1() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:10:33: Error: Getter not found: 'foo1'.
-A<X> Function<X>(X) bar1() => A.foo1; // Ok.
- ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
-static method bar2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:33: Error: Getter not found: 'foo2'.
-A<X> Function<X>(X) bar2() => A.foo2; // Error.
- ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test1() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:34: Error: Getter not found: 'foo1'.
+A<X> Function<X>(X) test1() => A.foo1; // Ok.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:12:34: Error: Getter not found: 'foo2'.
+A<X> Function<X>(X) test2() => A.foo2; // Error.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test3() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:34: Error: Getter not found: 'new'.
+A<X> Function<X>(X) test3() => A.new; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test4() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:39: Error: Getter not found: 'new'.
+A<X> Function<X>(X) test4() => A<int>.new; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test5() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:15:47: Error: Getter not found: 'new'.
+A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test6() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:16:39: Error: Getter not found: 'foo1'.
+A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test7() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:17:47: Error: Getter not found: 'foo1'.
+A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test8() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:18:39: Error: Getter not found: 'foo2'.
+A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test9() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:19:47: Error: Getter not found: 'foo2'.
+A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.strong.transformed.expect
index a746dcf..5b92215 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.strong.transformed.expect
@@ -2,13 +2,71 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:10:33: Error: Getter not found: 'foo1'.
-// A<X> Function<X>(X) bar1() => A.foo1; // Ok.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:34: Error: Getter not found: 'foo1'.
+// A<X> Function<X>(X) test1() => A.foo1; // Ok.
+// ^^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:33: Error: Getter not found: 'foo2'.
-// A<X> Function<X>(X) bar2() => A.foo2; // Error.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:12:34: Error: Getter not found: 'foo2'.
+// A<X> Function<X>(X) test2() => A.foo2; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:34: Error: Getter not found: 'new'.
+// A<X> Function<X>(X) test3() => A.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test4() => A<int>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:39: Error: Getter not found: 'new'.
+// A<X> Function<X>(X) test4() => A<int>.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:15:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:15:47: Error: Getter not found: 'new'.
+// A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:16:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:16:39: Error: Getter not found: 'foo1'.
+// A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:17:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:17:47: Error: Getter not found: 'foo1'.
+// A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:18:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:18:39: Error: Getter not found: 'foo2'.
+// A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:19:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:19:47: Error: Getter not found: 'foo2'.
+// A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
+// ^^^^
//
import self as self;
import "dart:core" as core;
@@ -18,13 +76,44 @@
: super core::Object::•() {}
constructor foo2(self::A::X% x, core::int y) → self::A<self::A::X%>
: super core::Object::•() {}
+ constructor •() → self::A<self::A::X%>
+ : super core::Object::•()
+ ;
}
-static method bar1() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:10:33: Error: Getter not found: 'foo1'.
-A<X> Function<X>(X) bar1() => A.foo1; // Ok.
- ^^^^";
-static method bar2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:33: Error: Getter not found: 'foo2'.
-A<X> Function<X>(X) bar2() => A.foo2; // Error.
- ^^^^";
+static method test1() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:34: Error: Getter not found: 'foo1'.
+A<X> Function<X>(X) test1() => A.foo1; // Ok.
+ ^^^^";
+static method test2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:12:34: Error: Getter not found: 'foo2'.
+A<X> Function<X>(X) test2() => A.foo2; // Error.
+ ^^^^";
+static method test3() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:34: Error: Getter not found: 'new'.
+A<X> Function<X>(X) test3() => A.new; // Error.
+ ^^^";
+static method test4() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:39: Error: Getter not found: 'new'.
+A<X> Function<X>(X) test4() => A<int>.new; // Error.
+ ^^^";
+static method test5() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:15:47: Error: Getter not found: 'new'.
+A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+ ^^^";
+static method test6() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:16:39: Error: Getter not found: 'foo1'.
+A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+ ^^^^";
+static method test7() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:17:47: Error: Getter not found: 'foo1'.
+A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+ ^^^^";
+static method test8() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:18:39: Error: Getter not found: 'foo2'.
+A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+ ^^^^";
+static method test9() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:19:47: Error: Getter not found: 'foo2'.
+A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
+ ^^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline.expect
index b3ddfbc..6aba9ce 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.textual_outline.expect
@@ -1,8 +1,15 @@
class A<X> {
A.foo1(X x) {}
A.foo2(X x, int y) {}
+ A();
}
-
-A<X> Function<X>(X) bar1() => A.foo1;
-A<X> Function<X>(X) bar2() => A.foo2;
+A<X> Function<X>(X) test1() => A.foo1;
+A<X> Function<X>(X) test2() => A.foo2;
+A<X> Function<X>(X) test3() => A.new;
+A<X> Function<X>(X) test4() => A<int>.new;
+A<X> Function<X>(X) test5() => A<int, String>.new;
+A<X> Function<X>(X) test6() => A<int>.foo1;
+A<X> Function<X>(X) test7() => A<int, String>.foo1;
+A<X> Function<X>(X) test8() => A<int>.foo2;
+A<X> Function<X>(X) test9() => A<int, String>.foo2;
main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.weak.expect
index 95d69d7..31c797b 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.weak.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.weak.expect
@@ -2,13 +2,71 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:10:33: Error: Getter not found: 'foo1'.
-// A<X> Function<X>(X) bar1() => A.foo1; // Ok.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:34: Error: Getter not found: 'foo1'.
+// A<X> Function<X>(X) test1() => A.foo1; // Ok.
+// ^^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:33: Error: Getter not found: 'foo2'.
-// A<X> Function<X>(X) bar2() => A.foo2; // Error.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:12:34: Error: Getter not found: 'foo2'.
+// A<X> Function<X>(X) test2() => A.foo2; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:34: Error: Getter not found: 'new'.
+// A<X> Function<X>(X) test3() => A.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test4() => A<int>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:39: Error: Getter not found: 'new'.
+// A<X> Function<X>(X) test4() => A<int>.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:15:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:15:47: Error: Getter not found: 'new'.
+// A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:16:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:16:39: Error: Getter not found: 'foo1'.
+// A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:17:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:17:47: Error: Getter not found: 'foo1'.
+// A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:18:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:18:39: Error: Getter not found: 'foo2'.
+// A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:19:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:19:47: Error: Getter not found: 'foo2'.
+// A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
+// ^^^^
//
import self as self;
import "dart:core" as core;
@@ -18,13 +76,44 @@
: super core::Object::•() {}
constructor foo2(self::A::X% x, core::int y) → self::A<self::A::X%>
: super core::Object::•() {}
+ constructor •() → self::A<self::A::X%>
+ : super core::Object::•()
+ ;
}
-static method bar1() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:10:33: Error: Getter not found: 'foo1'.
-A<X> Function<X>(X) bar1() => A.foo1; // Ok.
- ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
-static method bar2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:33: Error: Getter not found: 'foo2'.
-A<X> Function<X>(X) bar2() => A.foo2; // Error.
- ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test1() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:34: Error: Getter not found: 'foo1'.
+A<X> Function<X>(X) test1() => A.foo1; // Ok.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:12:34: Error: Getter not found: 'foo2'.
+A<X> Function<X>(X) test2() => A.foo2; // Error.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test3() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:34: Error: Getter not found: 'new'.
+A<X> Function<X>(X) test3() => A.new; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test4() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:39: Error: Getter not found: 'new'.
+A<X> Function<X>(X) test4() => A<int>.new; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test5() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:15:47: Error: Getter not found: 'new'.
+A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test6() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:16:39: Error: Getter not found: 'foo1'.
+A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test7() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:17:47: Error: Getter not found: 'foo1'.
+A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test8() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:18:39: Error: Getter not found: 'foo2'.
+A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
+static method test9() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:19:47: Error: Getter not found: 'foo2'.
+A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} <X extends core::Object? = dynamic>(X%) → self::A<X%>;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.weak.outline.expect
index 8de528e..4e4b8c9 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.weak.outline.expect
@@ -7,10 +7,26 @@
;
constructor foo2(self::A::X% x, core::int y) → self::A<self::A::X%>
;
+ constructor •() → self::A<self::A::X%>
+ ;
}
-static method bar1() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+static method test1() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
;
-static method bar2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+static method test2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ ;
+static method test3() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ ;
+static method test4() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ ;
+static method test5() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ ;
+static method test6() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ ;
+static method test7() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ ;
+static method test8() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ ;
+static method test9() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
;
static method main() → dynamic
;
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.weak.transformed.expect
index a746dcf..5b92215 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart.weak.transformed.expect
@@ -2,13 +2,71 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:10:33: Error: Getter not found: 'foo1'.
-// A<X> Function<X>(X) bar1() => A.foo1; // Ok.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:34: Error: Getter not found: 'foo1'.
+// A<X> Function<X>(X) test1() => A.foo1; // Ok.
+// ^^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:33: Error: Getter not found: 'foo2'.
-// A<X> Function<X>(X) bar2() => A.foo2; // Error.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:12:34: Error: Getter not found: 'foo2'.
+// A<X> Function<X>(X) test2() => A.foo2; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:34: Error: Getter not found: 'new'.
+// A<X> Function<X>(X) test3() => A.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test4() => A<int>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:39: Error: Getter not found: 'new'.
+// A<X> Function<X>(X) test4() => A<int>.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:15:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:15:47: Error: Getter not found: 'new'.
+// A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:16:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:16:39: Error: Getter not found: 'foo1'.
+// A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:17:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:17:47: Error: Getter not found: 'foo1'.
+// A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:18:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:18:39: Error: Getter not found: 'foo2'.
+// A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:19:33: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:19:47: Error: Getter not found: 'foo2'.
+// A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
+// ^^^^
//
import self as self;
import "dart:core" as core;
@@ -18,13 +76,44 @@
: super core::Object::•() {}
constructor foo2(self::A::X% x, core::int y) → self::A<self::A::X%>
: super core::Object::•() {}
+ constructor •() → self::A<self::A::X%>
+ : super core::Object::•()
+ ;
}
-static method bar1() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:10:33: Error: Getter not found: 'foo1'.
-A<X> Function<X>(X) bar1() => A.foo1; // Ok.
- ^^^^";
-static method bar2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:33: Error: Getter not found: 'foo2'.
-A<X> Function<X>(X) bar2() => A.foo2; // Error.
- ^^^^";
+static method test1() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:11:34: Error: Getter not found: 'foo1'.
+A<X> Function<X>(X) test1() => A.foo1; // Ok.
+ ^^^^";
+static method test2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:12:34: Error: Getter not found: 'foo2'.
+A<X> Function<X>(X) test2() => A.foo2; // Error.
+ ^^^^";
+static method test3() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:34: Error: Getter not found: 'new'.
+A<X> Function<X>(X) test3() => A.new; // Error.
+ ^^^";
+static method test4() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:39: Error: Getter not found: 'new'.
+A<X> Function<X>(X) test4() => A<int>.new; // Error.
+ ^^^";
+static method test5() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:15:47: Error: Getter not found: 'new'.
+A<X> Function<X>(X) test5() => A<int, String>.new; // Error.
+ ^^^";
+static method test6() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:16:39: Error: Getter not found: 'foo1'.
+A<X> Function<X>(X) test6() => A<int>.foo1; // Error.
+ ^^^^";
+static method test7() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:17:47: Error: Getter not found: 'foo1'.
+A<X> Function<X>(X) test7() => A<int, String>.foo1; // Error.
+ ^^^^";
+static method test8() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:18:39: Error: Getter not found: 'foo2'.
+A<X> Function<X>(X) test8() => A<int>.foo2; // Error.
+ ^^^^";
+static method test9() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:19:47: Error: Getter not found: 'foo2'.
+A<X> Function<X>(X) test9() => A<int, String>.foo2; // Error.
+ ^^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart
index 4d3ffb7..8536334 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart
@@ -4,8 +4,15 @@
class A<X> {
A.foo() {}
+ A() {}
}
-bar() => A.foo;
+testFoo() => A.foo; // Ok.
+testFooArgs() => A<int>.foo; // Ok.
+testNew() => A.new; // Ok.
+testNewArgs() => A<int>.new; // Ok.
+
+testFooExtraArgs() => A<int, String>.foo; // Error.
+testNewExtraArgs() => A<int, String>.new; // Error.
main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.strong.expect
index 0a46636..264979c 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.strong.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.strong.expect
@@ -2,9 +2,49 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-// bar() => A.foo;
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+// testFoo() => A.foo; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:11:19: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testFooArgs() => A<int>.foo; // Ok.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:11:25: Error: Getter not found: 'foo'.
+// testFooArgs() => A<int>.foo; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:12:16: Error: Getter not found: 'new'.
+// testNew() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:13:19: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testNewArgs() => A<int>.new; // Ok.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:13:25: Error: Getter not found: 'new'.
+// testNewArgs() => A<int>.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:15:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testFooExtraArgs() => A<int, String>.foo; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:15:38: Error: Getter not found: 'foo'.
+// testFooExtraArgs() => A<int, String>.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:16:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testNewExtraArgs() => A<int, String>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:16:38: Error: Getter not found: 'new'.
+// testNewExtraArgs() => A<int, String>.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -12,9 +52,31 @@
class A<X extends core::Object? = dynamic> extends core::Object {
constructor foo() → self::A<self::A::X%>
: super core::Object::•() {}
+ constructor •() → self::A<self::A::X%>
+ : super core::Object::•() {}
}
-static method bar() → dynamic
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-bar() => A.foo;
- ^^^";
+static method testFoo() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+testFoo() => A.foo; // Ok.
+ ^^^";
+static method testFooArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:11:25: Error: Getter not found: 'foo'.
+testFooArgs() => A<int>.foo; // Ok.
+ ^^^";
+static method testNew() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:12:16: Error: Getter not found: 'new'.
+testNew() => A.new; // Ok.
+ ^^^";
+static method testNewArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:13:25: Error: Getter not found: 'new'.
+testNewArgs() => A<int>.new; // Ok.
+ ^^^";
+static method testFooExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:15:38: Error: Getter not found: 'foo'.
+testFooExtraArgs() => A<int, String>.foo; // Error.
+ ^^^";
+static method testNewExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:16:38: Error: Getter not found: 'new'.
+testNewExtraArgs() => A<int, String>.new; // Error.
+ ^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.strong.transformed.expect
index 0a46636..264979c 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.strong.transformed.expect
@@ -2,9 +2,49 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-// bar() => A.foo;
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+// testFoo() => A.foo; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:11:19: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testFooArgs() => A<int>.foo; // Ok.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:11:25: Error: Getter not found: 'foo'.
+// testFooArgs() => A<int>.foo; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:12:16: Error: Getter not found: 'new'.
+// testNew() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:13:19: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testNewArgs() => A<int>.new; // Ok.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:13:25: Error: Getter not found: 'new'.
+// testNewArgs() => A<int>.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:15:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testFooExtraArgs() => A<int, String>.foo; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:15:38: Error: Getter not found: 'foo'.
+// testFooExtraArgs() => A<int, String>.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:16:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testNewExtraArgs() => A<int, String>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:16:38: Error: Getter not found: 'new'.
+// testNewExtraArgs() => A<int, String>.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -12,9 +52,31 @@
class A<X extends core::Object? = dynamic> extends core::Object {
constructor foo() → self::A<self::A::X%>
: super core::Object::•() {}
+ constructor •() → self::A<self::A::X%>
+ : super core::Object::•() {}
}
-static method bar() → dynamic
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-bar() => A.foo;
- ^^^";
+static method testFoo() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+testFoo() => A.foo; // Ok.
+ ^^^";
+static method testFooArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:11:25: Error: Getter not found: 'foo'.
+testFooArgs() => A<int>.foo; // Ok.
+ ^^^";
+static method testNew() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:12:16: Error: Getter not found: 'new'.
+testNew() => A.new; // Ok.
+ ^^^";
+static method testNewArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:13:25: Error: Getter not found: 'new'.
+testNewArgs() => A<int>.new; // Ok.
+ ^^^";
+static method testFooExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:15:38: Error: Getter not found: 'foo'.
+testFooExtraArgs() => A<int, String>.foo; // Error.
+ ^^^";
+static method testNewExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:16:38: Error: Getter not found: 'new'.
+testNewExtraArgs() => A<int, String>.new; // Error.
+ ^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.textual_outline.expect
index 515382f..79f321c 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.textual_outline.expect
@@ -1,6 +1,11 @@
class A<X> {
A.foo() {}
+ A() {}
}
-
-bar() => A.foo;
+testFoo() => A.foo;
+testFooArgs() => A<int>.foo;
+testNew() => A.new;
+testNewArgs() => A<int>.new;
+testFooExtraArgs() => A<int, String>.foo;
+testNewExtraArgs() => A<int, String>.new;
main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.weak.expect
index 0a46636..264979c 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.weak.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.weak.expect
@@ -2,9 +2,49 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-// bar() => A.foo;
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+// testFoo() => A.foo; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:11:19: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testFooArgs() => A<int>.foo; // Ok.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:11:25: Error: Getter not found: 'foo'.
+// testFooArgs() => A<int>.foo; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:12:16: Error: Getter not found: 'new'.
+// testNew() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:13:19: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testNewArgs() => A<int>.new; // Ok.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:13:25: Error: Getter not found: 'new'.
+// testNewArgs() => A<int>.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:15:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testFooExtraArgs() => A<int, String>.foo; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:15:38: Error: Getter not found: 'foo'.
+// testFooExtraArgs() => A<int, String>.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:16:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testNewExtraArgs() => A<int, String>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:16:38: Error: Getter not found: 'new'.
+// testNewExtraArgs() => A<int, String>.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -12,9 +52,31 @@
class A<X extends core::Object? = dynamic> extends core::Object {
constructor foo() → self::A<self::A::X%>
: super core::Object::•() {}
+ constructor •() → self::A<self::A::X%>
+ : super core::Object::•() {}
}
-static method bar() → dynamic
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-bar() => A.foo;
- ^^^";
+static method testFoo() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+testFoo() => A.foo; // Ok.
+ ^^^";
+static method testFooArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:11:25: Error: Getter not found: 'foo'.
+testFooArgs() => A<int>.foo; // Ok.
+ ^^^";
+static method testNew() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:12:16: Error: Getter not found: 'new'.
+testNew() => A.new; // Ok.
+ ^^^";
+static method testNewArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:13:25: Error: Getter not found: 'new'.
+testNewArgs() => A<int>.new; // Ok.
+ ^^^";
+static method testFooExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:15:38: Error: Getter not found: 'foo'.
+testFooExtraArgs() => A<int, String>.foo; // Error.
+ ^^^";
+static method testNewExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:16:38: Error: Getter not found: 'new'.
+testNewExtraArgs() => A<int, String>.new; // Error.
+ ^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.weak.outline.expect
index ff77296..b51752b 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.weak.outline.expect
@@ -5,8 +5,20 @@
class A<X extends core::Object? = dynamic> extends core::Object {
constructor foo() → self::A<self::A::X%>
;
+ constructor •() → self::A<self::A::X%>
+ ;
}
-static method bar() → dynamic
+static method testFoo() → dynamic
+ ;
+static method testFooArgs() → dynamic
+ ;
+static method testNew() → dynamic
+ ;
+static method testNewArgs() → dynamic
+ ;
+static method testFooExtraArgs() → dynamic
+ ;
+static method testNewExtraArgs() → dynamic
;
static method main() → dynamic
;
diff --git a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.weak.transformed.expect
index 0a46636..264979c 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart.weak.transformed.expect
@@ -2,9 +2,49 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-// bar() => A.foo;
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+// testFoo() => A.foo; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:11:19: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testFooArgs() => A<int>.foo; // Ok.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:11:25: Error: Getter not found: 'foo'.
+// testFooArgs() => A<int>.foo; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:12:16: Error: Getter not found: 'new'.
+// testNew() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:13:19: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testNewArgs() => A<int>.new; // Ok.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:13:25: Error: Getter not found: 'new'.
+// testNewArgs() => A<int>.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:15:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testFooExtraArgs() => A<int, String>.foo; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:15:38: Error: Getter not found: 'foo'.
+// testFooExtraArgs() => A<int, String>.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:16:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testNewExtraArgs() => A<int, String>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:16:38: Error: Getter not found: 'new'.
+// testNewExtraArgs() => A<int, String>.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -12,9 +52,31 @@
class A<X extends core::Object? = dynamic> extends core::Object {
constructor foo() → self::A<self::A::X%>
: super core::Object::•() {}
+ constructor •() → self::A<self::A::X%>
+ : super core::Object::•() {}
}
-static method bar() → dynamic
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-bar() => A.foo;
- ^^^";
+static method testFoo() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+testFoo() => A.foo; // Ok.
+ ^^^";
+static method testFooArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:11:25: Error: Getter not found: 'foo'.
+testFooArgs() => A<int>.foo; // Ok.
+ ^^^";
+static method testNew() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:12:16: Error: Getter not found: 'new'.
+testNew() => A.new; // Ok.
+ ^^^";
+static method testNewArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:13:25: Error: Getter not found: 'new'.
+testNewArgs() => A<int>.new; // Ok.
+ ^^^";
+static method testFooExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:15:38: Error: Getter not found: 'foo'.
+testFooExtraArgs() => A<int, String>.foo; // Error.
+ ^^^";
+static method testNewExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:16:38: Error: Getter not found: 'new'.
+testNewExtraArgs() => A<int, String>.new; // Error.
+ ^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart
index 4f840e8..5128252 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart
+++ b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart
@@ -4,10 +4,17 @@
class A<X extends num> {
A.foo(X x) {}
+ A(X x) {}
}
-A<num> Function(num) bar1() => A.foo; // Ok.
-A<int> Function(int) bar2() => A.foo; // Ok.
-A<dynamic> Function(String) bar3() => A.foo; // Error.
+A<num> Function(num) test1() => A.foo; // Ok.
+A<int> Function(int) test2() => A.foo; // Ok.
+A<num> Function(num) test3() => A.new; // Ok.
+A<int> Function(int) test4() => A.new; // Ok.
+
+A<dynamic> Function(String) test5() => A.foo; // Error.
+A<dynamic> Function(String) test6() => A.new; // Error.
+A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+A<dynamic> Function(num) test8() => A<num>.new; // Error.
main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.expect
index 2020766..7444b68 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.expect
@@ -2,17 +2,47 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:9:34: Error: Getter not found: 'foo'.
-// A<num> Function(num) bar1() => A.foo; // Ok.
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:35: Error: Getter not found: 'foo'.
+// A<num> Function(num) test1() => A.foo; // Ok.
+// ^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:34: Error: Getter not found: 'foo'.
-// A<int> Function(int) bar2() => A.foo; // Ok.
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:35: Error: Getter not found: 'foo'.
+// A<int> Function(int) test2() => A.foo; // Ok.
+// ^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:41: Error: Getter not found: 'foo'.
-// A<dynamic> Function(String) bar3() => A.foo; // Error.
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:12:35: Error: Getter not found: 'new'.
+// A<num> Function(num) test3() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:13:35: Error: Getter not found: 'new'.
+// A<int> Function(int) test4() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:15:42: Error: Getter not found: 'foo'.
+// A<dynamic> Function(String) test5() => A.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:42: Error: Getter not found: 'new'.
+// A<dynamic> Function(String) test6() => A.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:44: Error: Getter not found: 'foo'.
+// A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:18:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<dynamic> Function(num) test8() => A<num>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:18:44: Error: Getter not found: 'new'.
+// A<dynamic> Function(num) test8() => A<num>.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -20,17 +50,39 @@
class A<X extends core::num> extends core::Object {
constructor foo(self::A::X x) → self::A<self::A::X>
: super core::Object::•() {}
+ constructor •(self::A::X x) → self::A<self::A::X>
+ : super core::Object::•() {}
}
-static method bar1() → (core::num) → self::A<core::num>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:9:34: Error: Getter not found: 'foo'.
-A<num> Function(num) bar1() => A.foo; // Ok.
- ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::num) → self::A<core::num>;
-static method bar2() → (core::int) → self::A<core::int>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:34: Error: Getter not found: 'foo'.
-A<int> Function(int) bar2() => A.foo; // Ok.
- ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::int) → self::A<core::int>;
-static method bar3() → (core::String) → self::A<dynamic>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:41: Error: Getter not found: 'foo'.
-A<dynamic> Function(String) bar3() => A.foo; // Error.
- ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::String) → self::A<dynamic>;
+static method test1() → (core::num) → self::A<core::num>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:35: Error: Getter not found: 'foo'.
+A<num> Function(num) test1() => A.foo; // Ok.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::num) → self::A<core::num>;
+static method test2() → (core::int) → self::A<core::int>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:35: Error: Getter not found: 'foo'.
+A<int> Function(int) test2() => A.foo; // Ok.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::int) → self::A<core::int>;
+static method test3() → (core::num) → self::A<core::num>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:12:35: Error: Getter not found: 'new'.
+A<num> Function(num) test3() => A.new; // Ok.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::num) → self::A<core::num>;
+static method test4() → (core::int) → self::A<core::int>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:13:35: Error: Getter not found: 'new'.
+A<int> Function(int) test4() => A.new; // Ok.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::int) → self::A<core::int>;
+static method test5() → (core::String) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:15:42: Error: Getter not found: 'foo'.
+A<dynamic> Function(String) test5() => A.foo; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::String) → self::A<dynamic>;
+static method test6() → (core::String) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:42: Error: Getter not found: 'new'.
+A<dynamic> Function(String) test6() => A.new; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::String) → self::A<dynamic>;
+static method test7() → (core::num) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:44: Error: Getter not found: 'foo'.
+A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::num) → self::A<dynamic>;
+static method test8() → (core::num) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:18:44: Error: Getter not found: 'new'.
+A<dynamic> Function(num) test8() => A<num>.new; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::num) → self::A<dynamic>;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.transformed.expect
index c3344f6..3a5a5ad 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.strong.transformed.expect
@@ -2,17 +2,47 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:9:34: Error: Getter not found: 'foo'.
-// A<num> Function(num) bar1() => A.foo; // Ok.
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:35: Error: Getter not found: 'foo'.
+// A<num> Function(num) test1() => A.foo; // Ok.
+// ^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:34: Error: Getter not found: 'foo'.
-// A<int> Function(int) bar2() => A.foo; // Ok.
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:35: Error: Getter not found: 'foo'.
+// A<int> Function(int) test2() => A.foo; // Ok.
+// ^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:41: Error: Getter not found: 'foo'.
-// A<dynamic> Function(String) bar3() => A.foo; // Error.
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:12:35: Error: Getter not found: 'new'.
+// A<num> Function(num) test3() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:13:35: Error: Getter not found: 'new'.
+// A<int> Function(int) test4() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:15:42: Error: Getter not found: 'foo'.
+// A<dynamic> Function(String) test5() => A.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:42: Error: Getter not found: 'new'.
+// A<dynamic> Function(String) test6() => A.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:44: Error: Getter not found: 'foo'.
+// A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:18:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<dynamic> Function(num) test8() => A<num>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:18:44: Error: Getter not found: 'new'.
+// A<dynamic> Function(num) test8() => A<num>.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -20,17 +50,39 @@
class A<X extends core::num> extends core::Object {
constructor foo(self::A::X x) → self::A<self::A::X>
: super core::Object::•() {}
+ constructor •(self::A::X x) → self::A<self::A::X>
+ : super core::Object::•() {}
}
-static method bar1() → (core::num) → self::A<core::num>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:9:34: Error: Getter not found: 'foo'.
-A<num> Function(num) bar1() => A.foo; // Ok.
- ^^^";
-static method bar2() → (core::int) → self::A<core::int>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:34: Error: Getter not found: 'foo'.
-A<int> Function(int) bar2() => A.foo; // Ok.
- ^^^";
-static method bar3() → (core::String) → self::A<dynamic>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:41: Error: Getter not found: 'foo'.
-A<dynamic> Function(String) bar3() => A.foo; // Error.
- ^^^";
+static method test1() → (core::num) → self::A<core::num>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:35: Error: Getter not found: 'foo'.
+A<num> Function(num) test1() => A.foo; // Ok.
+ ^^^";
+static method test2() → (core::int) → self::A<core::int>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:35: Error: Getter not found: 'foo'.
+A<int> Function(int) test2() => A.foo; // Ok.
+ ^^^";
+static method test3() → (core::num) → self::A<core::num>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:12:35: Error: Getter not found: 'new'.
+A<num> Function(num) test3() => A.new; // Ok.
+ ^^^";
+static method test4() → (core::int) → self::A<core::int>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:13:35: Error: Getter not found: 'new'.
+A<int> Function(int) test4() => A.new; // Ok.
+ ^^^";
+static method test5() → (core::String) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:15:42: Error: Getter not found: 'foo'.
+A<dynamic> Function(String) test5() => A.foo; // Error.
+ ^^^";
+static method test6() → (core::String) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:42: Error: Getter not found: 'new'.
+A<dynamic> Function(String) test6() => A.new; // Error.
+ ^^^";
+static method test7() → (core::num) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:44: Error: Getter not found: 'foo'.
+A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+ ^^^";
+static method test8() → (core::num) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:18:44: Error: Getter not found: 'new'.
+A<dynamic> Function(num) test8() => A<num>.new; // Error.
+ ^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.textual_outline.expect
index 2b61a62..11dd004 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.textual_outline.expect
@@ -1,8 +1,13 @@
class A<X extends num> {
A.foo(X x) {}
+ A(X x) {}
}
-
-A<num> Function(num) bar1() => A.foo;
-A<int> Function(int) bar2() => A.foo;
-A<dynamic> Function(String) bar3() => A.foo;
+A<num> Function(num) test1() => A.foo;
+A<int> Function(int) test2() => A.foo;
+A<num> Function(num) test3() => A.new;
+A<int> Function(int) test4() => A.new;
+A<dynamic> Function(String) test5() => A.foo;
+A<dynamic> Function(String) test6() => A.new;
+A<dynamic> Function(num) test7() => A<num>.foo;
+A<dynamic> Function(num) test8() => A<num>.new;
main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.weak.expect
index 2020766..7444b68 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.weak.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.weak.expect
@@ -2,17 +2,47 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:9:34: Error: Getter not found: 'foo'.
-// A<num> Function(num) bar1() => A.foo; // Ok.
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:35: Error: Getter not found: 'foo'.
+// A<num> Function(num) test1() => A.foo; // Ok.
+// ^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:34: Error: Getter not found: 'foo'.
-// A<int> Function(int) bar2() => A.foo; // Ok.
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:35: Error: Getter not found: 'foo'.
+// A<int> Function(int) test2() => A.foo; // Ok.
+// ^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:41: Error: Getter not found: 'foo'.
-// A<dynamic> Function(String) bar3() => A.foo; // Error.
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:12:35: Error: Getter not found: 'new'.
+// A<num> Function(num) test3() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:13:35: Error: Getter not found: 'new'.
+// A<int> Function(int) test4() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:15:42: Error: Getter not found: 'foo'.
+// A<dynamic> Function(String) test5() => A.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:42: Error: Getter not found: 'new'.
+// A<dynamic> Function(String) test6() => A.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:44: Error: Getter not found: 'foo'.
+// A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:18:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<dynamic> Function(num) test8() => A<num>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:18:44: Error: Getter not found: 'new'.
+// A<dynamic> Function(num) test8() => A<num>.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -20,17 +50,39 @@
class A<X extends core::num> extends core::Object {
constructor foo(self::A::X x) → self::A<self::A::X>
: super core::Object::•() {}
+ constructor •(self::A::X x) → self::A<self::A::X>
+ : super core::Object::•() {}
}
-static method bar1() → (core::num) → self::A<core::num>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:9:34: Error: Getter not found: 'foo'.
-A<num> Function(num) bar1() => A.foo; // Ok.
- ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::num) → self::A<core::num>;
-static method bar2() → (core::int) → self::A<core::int>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:34: Error: Getter not found: 'foo'.
-A<int> Function(int) bar2() => A.foo; // Ok.
- ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::int) → self::A<core::int>;
-static method bar3() → (core::String) → self::A<dynamic>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:41: Error: Getter not found: 'foo'.
-A<dynamic> Function(String) bar3() => A.foo; // Error.
- ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::String) → self::A<dynamic>;
+static method test1() → (core::num) → self::A<core::num>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:35: Error: Getter not found: 'foo'.
+A<num> Function(num) test1() => A.foo; // Ok.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::num) → self::A<core::num>;
+static method test2() → (core::int) → self::A<core::int>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:35: Error: Getter not found: 'foo'.
+A<int> Function(int) test2() => A.foo; // Ok.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::int) → self::A<core::int>;
+static method test3() → (core::num) → self::A<core::num>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:12:35: Error: Getter not found: 'new'.
+A<num> Function(num) test3() => A.new; // Ok.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::num) → self::A<core::num>;
+static method test4() → (core::int) → self::A<core::int>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:13:35: Error: Getter not found: 'new'.
+A<int> Function(int) test4() => A.new; // Ok.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::int) → self::A<core::int>;
+static method test5() → (core::String) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:15:42: Error: Getter not found: 'foo'.
+A<dynamic> Function(String) test5() => A.foo; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::String) → self::A<dynamic>;
+static method test6() → (core::String) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:42: Error: Getter not found: 'new'.
+A<dynamic> Function(String) test6() => A.new; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::String) → self::A<dynamic>;
+static method test7() → (core::num) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:44: Error: Getter not found: 'foo'.
+A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::num) → self::A<dynamic>;
+static method test8() → (core::num) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:18:44: Error: Getter not found: 'new'.
+A<dynamic> Function(num) test8() => A<num>.new; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::num) → self::A<dynamic>;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.weak.outline.expect
index a528382..c33b72e 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.weak.outline.expect
@@ -5,12 +5,24 @@
class A<X extends core::num> extends core::Object {
constructor foo(self::A::X x) → self::A<self::A::X>
;
+ constructor •(self::A::X x) → self::A<self::A::X>
+ ;
}
-static method bar1() → (core::num) → self::A<core::num>
+static method test1() → (core::num) → self::A<core::num>
;
-static method bar2() → (core::int) → self::A<core::int>
+static method test2() → (core::int) → self::A<core::int>
;
-static method bar3() → (core::String) → self::A<dynamic>
+static method test3() → (core::num) → self::A<core::num>
+ ;
+static method test4() → (core::int) → self::A<core::int>
+ ;
+static method test5() → (core::String) → self::A<dynamic>
+ ;
+static method test6() → (core::String) → self::A<dynamic>
+ ;
+static method test7() → (core::num) → self::A<dynamic>
+ ;
+static method test8() → (core::num) → self::A<dynamic>
;
static method main() → dynamic
;
diff --git a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.weak.transformed.expect
index c3344f6..3a5a5ad 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/instantiation.dart.weak.transformed.expect
@@ -2,17 +2,47 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:9:34: Error: Getter not found: 'foo'.
-// A<num> Function(num) bar1() => A.foo; // Ok.
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:35: Error: Getter not found: 'foo'.
+// A<num> Function(num) test1() => A.foo; // Ok.
+// ^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:34: Error: Getter not found: 'foo'.
-// A<int> Function(int) bar2() => A.foo; // Ok.
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:35: Error: Getter not found: 'foo'.
+// A<int> Function(int) test2() => A.foo; // Ok.
+// ^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:41: Error: Getter not found: 'foo'.
-// A<dynamic> Function(String) bar3() => A.foo; // Error.
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:12:35: Error: Getter not found: 'new'.
+// A<num> Function(num) test3() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:13:35: Error: Getter not found: 'new'.
+// A<int> Function(int) test4() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:15:42: Error: Getter not found: 'foo'.
+// A<dynamic> Function(String) test5() => A.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:42: Error: Getter not found: 'new'.
+// A<dynamic> Function(String) test6() => A.new; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:44: Error: Getter not found: 'foo'.
+// A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:18:38: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// A<dynamic> Function(num) test8() => A<num>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:18:44: Error: Getter not found: 'new'.
+// A<dynamic> Function(num) test8() => A<num>.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -20,17 +50,39 @@
class A<X extends core::num> extends core::Object {
constructor foo(self::A::X x) → self::A<self::A::X>
: super core::Object::•() {}
+ constructor •(self::A::X x) → self::A<self::A::X>
+ : super core::Object::•() {}
}
-static method bar1() → (core::num) → self::A<core::num>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:9:34: Error: Getter not found: 'foo'.
-A<num> Function(num) bar1() => A.foo; // Ok.
- ^^^";
-static method bar2() → (core::int) → self::A<core::int>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:34: Error: Getter not found: 'foo'.
-A<int> Function(int) bar2() => A.foo; // Ok.
- ^^^";
-static method bar3() → (core::String) → self::A<dynamic>
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:41: Error: Getter not found: 'foo'.
-A<dynamic> Function(String) bar3() => A.foo; // Error.
- ^^^";
+static method test1() → (core::num) → self::A<core::num>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:10:35: Error: Getter not found: 'foo'.
+A<num> Function(num) test1() => A.foo; // Ok.
+ ^^^";
+static method test2() → (core::int) → self::A<core::int>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:11:35: Error: Getter not found: 'foo'.
+A<int> Function(int) test2() => A.foo; // Ok.
+ ^^^";
+static method test3() → (core::num) → self::A<core::num>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:12:35: Error: Getter not found: 'new'.
+A<num> Function(num) test3() => A.new; // Ok.
+ ^^^";
+static method test4() → (core::int) → self::A<core::int>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:13:35: Error: Getter not found: 'new'.
+A<int> Function(int) test4() => A.new; // Ok.
+ ^^^";
+static method test5() → (core::String) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:15:42: Error: Getter not found: 'foo'.
+A<dynamic> Function(String) test5() => A.foo; // Error.
+ ^^^";
+static method test6() → (core::String) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:16:42: Error: Getter not found: 'new'.
+A<dynamic> Function(String) test6() => A.new; // Error.
+ ^^^";
+static method test7() → (core::num) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:44: Error: Getter not found: 'foo'.
+A<dynamic> Function(num) test7() => A<num>.foo; // Error.
+ ^^^";
+static method test8() → (core::num) → self::A<dynamic>
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:18:44: Error: Getter not found: 'new'.
+A<dynamic> Function(num) test8() => A<num>.new; // Error.
+ ^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart
index 1cfbb36..32eda21 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart
@@ -5,9 +5,12 @@
class A {
A.foo1() {}
A.foo2(int x) {}
+ A() {}
}
-A Function() bar1() => A.foo1; // Ok.
-A Function() bar2() => A.foo2; // Error.
+A Function() test1() => A.foo1; // Ok.
+A Function() test2() => A.foo2; // Error.
+A Function() test3() => A.new; // Ok.
+A Function(int) test4() => A.new; // Error.
main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.strong.expect
index 3b24555..905eda3 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.strong.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.strong.expect
@@ -2,13 +2,21 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:10:26: Error: Getter not found: 'foo1'.
-// A Function() bar1() => A.foo1; // Ok.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:27: Error: Getter not found: 'foo1'.
+// A Function() test1() => A.foo1; // Ok.
+// ^^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:26: Error: Getter not found: 'foo2'.
-// A Function() bar2() => A.foo2; // Error.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:12:27: Error: Getter not found: 'foo2'.
+// A Function() test2() => A.foo2; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:13:27: Error: Getter not found: 'new'.
+// A Function() test3() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:14:30: Error: Getter not found: 'new'.
+// A Function(int) test4() => A.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -18,13 +26,23 @@
: super core::Object::•() {}
constructor foo2(core::int x) → self::A
: super core::Object::•() {}
+ constructor •() → self::A
+ : super core::Object::•() {}
}
-static method bar1() → () → self::A
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:10:26: Error: Getter not found: 'foo1'.
-A Function() bar1() => A.foo1; // Ok.
- ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} () → self::A;
-static method bar2() → () → self::A
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:26: Error: Getter not found: 'foo2'.
-A Function() bar2() => A.foo2; // Error.
- ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} () → self::A;
+static method test1() → () → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:27: Error: Getter not found: 'foo1'.
+A Function() test1() => A.foo1; // Ok.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} () → self::A;
+static method test2() → () → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:12:27: Error: Getter not found: 'foo2'.
+A Function() test2() => A.foo2; // Error.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} () → self::A;
+static method test3() → () → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:13:27: Error: Getter not found: 'new'.
+A Function() test3() => A.new; // Ok.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} () → self::A;
+static method test4() → (core::int) → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:14:30: Error: Getter not found: 'new'.
+A Function(int) test4() => A.new; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::int) → self::A;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.strong.transformed.expect
index 9e2a295..26fd1c7 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.strong.transformed.expect
@@ -2,13 +2,21 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:10:26: Error: Getter not found: 'foo1'.
-// A Function() bar1() => A.foo1; // Ok.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:27: Error: Getter not found: 'foo1'.
+// A Function() test1() => A.foo1; // Ok.
+// ^^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:26: Error: Getter not found: 'foo2'.
-// A Function() bar2() => A.foo2; // Error.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:12:27: Error: Getter not found: 'foo2'.
+// A Function() test2() => A.foo2; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:13:27: Error: Getter not found: 'new'.
+// A Function() test3() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:14:30: Error: Getter not found: 'new'.
+// A Function(int) test4() => A.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -18,13 +26,23 @@
: super core::Object::•() {}
constructor foo2(core::int x) → self::A
: super core::Object::•() {}
+ constructor •() → self::A
+ : super core::Object::•() {}
}
-static method bar1() → () → self::A
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:10:26: Error: Getter not found: 'foo1'.
-A Function() bar1() => A.foo1; // Ok.
- ^^^^";
-static method bar2() → () → self::A
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:26: Error: Getter not found: 'foo2'.
-A Function() bar2() => A.foo2; // Error.
- ^^^^";
+static method test1() → () → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:27: Error: Getter not found: 'foo1'.
+A Function() test1() => A.foo1; // Ok.
+ ^^^^";
+static method test2() → () → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:12:27: Error: Getter not found: 'foo2'.
+A Function() test2() => A.foo2; // Error.
+ ^^^^";
+static method test3() → () → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:13:27: Error: Getter not found: 'new'.
+A Function() test3() => A.new; // Ok.
+ ^^^";
+static method test4() → (core::int) → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:14:30: Error: Getter not found: 'new'.
+A Function(int) test4() => A.new; // Error.
+ ^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.textual_outline.expect
index f247550..9ff49d9 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.textual_outline.expect
@@ -1,8 +1,10 @@
class A {
A.foo1() {}
A.foo2(int x) {}
+ A() {}
}
-
-A Function() bar1() => A.foo1;
-A Function() bar2() => A.foo2;
+A Function() test1() => A.foo1;
+A Function() test2() => A.foo2;
+A Function() test3() => A.new;
+A Function(int) test4() => A.new;
main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.weak.expect
index 3b24555..905eda3 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.weak.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.weak.expect
@@ -2,13 +2,21 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:10:26: Error: Getter not found: 'foo1'.
-// A Function() bar1() => A.foo1; // Ok.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:27: Error: Getter not found: 'foo1'.
+// A Function() test1() => A.foo1; // Ok.
+// ^^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:26: Error: Getter not found: 'foo2'.
-// A Function() bar2() => A.foo2; // Error.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:12:27: Error: Getter not found: 'foo2'.
+// A Function() test2() => A.foo2; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:13:27: Error: Getter not found: 'new'.
+// A Function() test3() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:14:30: Error: Getter not found: 'new'.
+// A Function(int) test4() => A.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -18,13 +26,23 @@
: super core::Object::•() {}
constructor foo2(core::int x) → self::A
: super core::Object::•() {}
+ constructor •() → self::A
+ : super core::Object::•() {}
}
-static method bar1() → () → self::A
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:10:26: Error: Getter not found: 'foo1'.
-A Function() bar1() => A.foo1; // Ok.
- ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} () → self::A;
-static method bar2() → () → self::A
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:26: Error: Getter not found: 'foo2'.
-A Function() bar2() => A.foo2; // Error.
- ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} () → self::A;
+static method test1() → () → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:27: Error: Getter not found: 'foo1'.
+A Function() test1() => A.foo1; // Ok.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} () → self::A;
+static method test2() → () → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:12:27: Error: Getter not found: 'foo2'.
+A Function() test2() => A.foo2; // Error.
+ ^^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} () → self::A;
+static method test3() → () → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:13:27: Error: Getter not found: 'new'.
+A Function() test3() => A.new; // Ok.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} () → self::A;
+static method test4() → (core::int) → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:14:30: Error: Getter not found: 'new'.
+A Function(int) test4() => A.new; // Error.
+ ^^^" as{TypeError,ForDynamic,ForNonNullableByDefault} (core::int) → self::A;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.weak.outline.expect
index f822cfc..72f6e7a 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.weak.outline.expect
@@ -7,10 +7,16 @@
;
constructor foo2(core::int x) → self::A
;
+ constructor •() → self::A
+ ;
}
-static method bar1() → () → self::A
+static method test1() → () → self::A
;
-static method bar2() → () → self::A
+static method test2() → () → self::A
+ ;
+static method test3() → () → self::A
+ ;
+static method test4() → (core::int) → self::A
;
static method main() → dynamic
;
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.weak.transformed.expect
index 9e2a295..26fd1c7 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart.weak.transformed.expect
@@ -2,13 +2,21 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:10:26: Error: Getter not found: 'foo1'.
-// A Function() bar1() => A.foo1; // Ok.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:27: Error: Getter not found: 'foo1'.
+// A Function() test1() => A.foo1; // Ok.
+// ^^^^
//
-// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:26: Error: Getter not found: 'foo2'.
-// A Function() bar2() => A.foo2; // Error.
-// ^^^^
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:12:27: Error: Getter not found: 'foo2'.
+// A Function() test2() => A.foo2; // Error.
+// ^^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:13:27: Error: Getter not found: 'new'.
+// A Function() test3() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:14:30: Error: Getter not found: 'new'.
+// A Function(int) test4() => A.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -18,13 +26,23 @@
: super core::Object::•() {}
constructor foo2(core::int x) → self::A
: super core::Object::•() {}
+ constructor •() → self::A
+ : super core::Object::•() {}
}
-static method bar1() → () → self::A
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:10:26: Error: Getter not found: 'foo1'.
-A Function() bar1() => A.foo1; // Ok.
- ^^^^";
-static method bar2() → () → self::A
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:26: Error: Getter not found: 'foo2'.
-A Function() bar2() => A.foo2; // Error.
- ^^^^";
+static method test1() → () → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:11:27: Error: Getter not found: 'foo1'.
+A Function() test1() => A.foo1; // Ok.
+ ^^^^";
+static method test2() → () → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:12:27: Error: Getter not found: 'foo2'.
+A Function() test2() => A.foo2; // Error.
+ ^^^^";
+static method test3() → () → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:13:27: Error: Getter not found: 'new'.
+A Function() test3() => A.new; // Ok.
+ ^^^";
+static method test4() → (core::int) → self::A
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_with_context.dart:14:30: Error: Getter not found: 'new'.
+A Function(int) test4() => A.new; // Error.
+ ^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart
index b2f8b30..d132fae 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart
@@ -4,8 +4,13 @@
class A {
A.foo() {}
+ A() {}
}
-bar() => A.foo;
+testFoo() => A.foo; // Ok.
+testNew() => A.new; // Ok.
+
+testFooExtraArgs() => A<int>.foo; // Error.
+testNewExtraArgs() => A<int>.new; // Error.
main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.strong.expect
index 2cbc6e8..4374264 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.strong.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.strong.expect
@@ -2,9 +2,31 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-// bar() => A.foo;
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+// testFoo() => A.foo; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:11:16: Error: Getter not found: 'new'.
+// testNew() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:13:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testFooExtraArgs() => A<int>.foo; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:13:30: Error: Getter not found: 'foo'.
+// testFooExtraArgs() => A<int>.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:14:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testNewExtraArgs() => A<int>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:14:30: Error: Getter not found: 'new'.
+// testNewExtraArgs() => A<int>.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -12,9 +34,23 @@
class A extends core::Object {
constructor foo() → self::A
: super core::Object::•() {}
+ constructor •() → self::A
+ : super core::Object::•() {}
}
-static method bar() → dynamic
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-bar() => A.foo;
- ^^^";
+static method testFoo() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+testFoo() => A.foo; // Ok.
+ ^^^";
+static method testNew() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:11:16: Error: Getter not found: 'new'.
+testNew() => A.new; // Ok.
+ ^^^";
+static method testFooExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:13:30: Error: Getter not found: 'foo'.
+testFooExtraArgs() => A<int>.foo; // Error.
+ ^^^";
+static method testNewExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:14:30: Error: Getter not found: 'new'.
+testNewExtraArgs() => A<int>.new; // Error.
+ ^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.strong.transformed.expect
index 2cbc6e8..4374264 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.strong.transformed.expect
@@ -2,9 +2,31 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-// bar() => A.foo;
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+// testFoo() => A.foo; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:11:16: Error: Getter not found: 'new'.
+// testNew() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:13:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testFooExtraArgs() => A<int>.foo; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:13:30: Error: Getter not found: 'foo'.
+// testFooExtraArgs() => A<int>.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:14:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testNewExtraArgs() => A<int>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:14:30: Error: Getter not found: 'new'.
+// testNewExtraArgs() => A<int>.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -12,9 +34,23 @@
class A extends core::Object {
constructor foo() → self::A
: super core::Object::•() {}
+ constructor •() → self::A
+ : super core::Object::•() {}
}
-static method bar() → dynamic
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-bar() => A.foo;
- ^^^";
+static method testFoo() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+testFoo() => A.foo; // Ok.
+ ^^^";
+static method testNew() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:11:16: Error: Getter not found: 'new'.
+testNew() => A.new; // Ok.
+ ^^^";
+static method testFooExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:13:30: Error: Getter not found: 'foo'.
+testFooExtraArgs() => A<int>.foo; // Error.
+ ^^^";
+static method testNewExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:14:30: Error: Getter not found: 'new'.
+testNewExtraArgs() => A<int>.new; // Error.
+ ^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.textual_outline.expect
index 1a79c8b..7f58e61 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.textual_outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.textual_outline.expect
@@ -1,6 +1,9 @@
class A {
A.foo() {}
+ A() {}
}
-
-bar() => A.foo;
+testFoo() => A.foo;
+testNew() => A.new;
+testFooExtraArgs() => A<int>.foo;
+testNewExtraArgs() => A<int>.new;
main() {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.weak.expect
index 2cbc6e8..4374264 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.weak.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.weak.expect
@@ -2,9 +2,31 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-// bar() => A.foo;
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+// testFoo() => A.foo; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:11:16: Error: Getter not found: 'new'.
+// testNew() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:13:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testFooExtraArgs() => A<int>.foo; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:13:30: Error: Getter not found: 'foo'.
+// testFooExtraArgs() => A<int>.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:14:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testNewExtraArgs() => A<int>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:14:30: Error: Getter not found: 'new'.
+// testNewExtraArgs() => A<int>.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -12,9 +34,23 @@
class A extends core::Object {
constructor foo() → self::A
: super core::Object::•() {}
+ constructor •() → self::A
+ : super core::Object::•() {}
}
-static method bar() → dynamic
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-bar() => A.foo;
- ^^^";
+static method testFoo() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+testFoo() => A.foo; // Ok.
+ ^^^";
+static method testNew() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:11:16: Error: Getter not found: 'new'.
+testNew() => A.new; // Ok.
+ ^^^";
+static method testFooExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:13:30: Error: Getter not found: 'foo'.
+testFooExtraArgs() => A<int>.foo; // Error.
+ ^^^";
+static method testNewExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:14:30: Error: Getter not found: 'new'.
+testNewExtraArgs() => A<int>.new; // Error.
+ ^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.weak.outline.expect
index ef14ea5..f5e6c30 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.weak.outline.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.weak.outline.expect
@@ -5,8 +5,16 @@
class A extends core::Object {
constructor foo() → self::A
;
+ constructor •() → self::A
+ ;
}
-static method bar() → dynamic
+static method testFoo() → dynamic
+ ;
+static method testNew() → dynamic
+ ;
+static method testFooExtraArgs() → dynamic
+ ;
+static method testNewExtraArgs() → dynamic
;
static method main() → dynamic
;
diff --git a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.weak.transformed.expect
index 2cbc6e8..4374264 100644
--- a/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.weak.transformed.expect
+++ b/pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart.weak.transformed.expect
@@ -2,9 +2,31 @@
//
// Problems in library:
//
-// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-// bar() => A.foo;
-// ^^^
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+// testFoo() => A.foo; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:11:16: Error: Getter not found: 'new'.
+// testNew() => A.new; // Ok.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:13:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testFooExtraArgs() => A<int>.foo; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:13:30: Error: Getter not found: 'foo'.
+// testFooExtraArgs() => A<int>.foo; // Error.
+// ^^^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:14:24: Error: This requires the 'constructor-tearoffs' language feature to be enabled.
+// Try updating your pubspec.yaml to set the minimum SDK constraint to 2.14 or higher, and running 'pub get'.
+// testNewExtraArgs() => A<int>.new; // Error.
+// ^
+//
+// pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:14:30: Error: Getter not found: 'new'.
+// testNewExtraArgs() => A<int>.new; // Error.
+// ^^^
//
import self as self;
import "dart:core" as core;
@@ -12,9 +34,23 @@
class A extends core::Object {
constructor foo() → self::A
: super core::Object::•() {}
+ constructor •() → self::A
+ : super core::Object::•() {}
}
-static method bar() → dynamic
- return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:9:12: Error: Getter not found: 'foo'.
-bar() => A.foo;
- ^^^";
+static method testFoo() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:10:16: Error: Getter not found: 'foo'.
+testFoo() => A.foo; // Ok.
+ ^^^";
+static method testNew() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:11:16: Error: Getter not found: 'new'.
+testNew() => A.new; // Ok.
+ ^^^";
+static method testFooExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:13:30: Error: Getter not found: 'foo'.
+testFooExtraArgs() => A<int>.foo; // Error.
+ ^^^";
+static method testNewExtraArgs() → dynamic
+ return invalid-expression "pkg/front_end/testcases/constructor_tearoffs/nongeneric_tearoff_without_context.dart:14:30: Error: Getter not found: 'new'.
+testNewExtraArgs() => A<int>.new; // Error.
+ ^^^";
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/textual_outline.status b/pkg/front_end/testcases/textual_outline.status
index da0c0e1..2e24e68 100644
--- a/pkg/front_end/testcases/textual_outline.status
+++ b/pkg/front_end/testcases/textual_outline.status
@@ -23,6 +23,11 @@
const_functions/const_functions_const_ctor: FormatterCrash
const_functions/const_functions_const_ctor_error: FormatterCrash
const_functions/const_functions_const_factory: FormatterCrash
+constructor_tearoffs/generic_tearoff_with_context: FormatterCrash
+constructor_tearoffs/generic_tearoff_without_context: FormatterCrash
+constructor_tearoffs/instantiation: FormatterCrash
+constructor_tearoffs/nongeneric_tearoff_with_context: FormatterCrash
+constructor_tearoffs/nongeneric_tearoff_without_context: FormatterCrash
dart2js/late_fields: FormatterCrash
dart2js/late_statics: FormatterCrash
extensions/extension_constructor: FormatterCrash
diff --git a/pkg/frontend_server/lib/compute_kernel.dart b/pkg/frontend_server/lib/compute_kernel.dart
new file mode 100644
index 0000000..b6c5616
--- /dev/null
+++ b/pkg/frontend_server/lib/compute_kernel.dart
@@ -0,0 +1,426 @@
+// 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.
+
+// @dart = 2.8
+
+/// A library to invoke the CFE to compute kernel summary files.
+///
+/// Used by `utils/bazel/kernel_worker.dart`.
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:args/args.dart';
+import 'package:build_integration/file_system/multi_root.dart';
+import 'package:compiler/src/kernel/dart2js_target.dart';
+import 'package:dev_compiler/src/kernel/target.dart';
+import 'package:front_end/src/api_unstable/bazel_worker.dart' as fe;
+import 'package:kernel/ast.dart' show Component, Library, Reference;
+import 'package:kernel/target/targets.dart';
+import 'package:vm/target/flutter.dart';
+import 'package:vm/target/flutter_runner.dart';
+import 'package:vm/target/vm.dart';
+
+/// If the last arg starts with `@`, this reads the file it points to and treats
+/// each line as an additional arg.
+///
+/// This is how individual work request args are differentiated from startup
+/// args in bazel (individual work request args go in that file).
+List<String> preprocessArgs(List<String> args) {
+ args = new List.from(args);
+ if (args.isEmpty) {
+ return args;
+ }
+ String lastArg = args.last;
+ if (lastArg.startsWith('@')) {
+ File argsFile = new File(lastArg.substring(1));
+ try {
+ args.removeLast();
+ args.addAll(argsFile.readAsLinesSync());
+ } on FileSystemException catch (e) {
+ throw new Exception('Failed to read file specified by $lastArg : $e');
+ }
+ }
+ return args;
+}
+
+/// An [ArgParser] for generating kernel summaries.
+final summaryArgsParser = new ArgParser()
+ ..addFlag('help', negatable: false, abbr: 'h')
+ ..addFlag('exclude-non-sources',
+ negatable: false,
+ help: 'Whether source files loaded implicitly should be included as '
+ 'part of the summary.')
+ ..addFlag('summary-only',
+ defaultsTo: true,
+ negatable: true,
+ help: 'Whether to only build summary files.')
+ ..addOption('target',
+ allowed: const [
+ 'vm',
+ 'flutter',
+ 'flutter_runner',
+ 'dart2js',
+ 'ddc',
+ ],
+ help: 'Build kernel for the vm, flutter, flutter_runner, dart2js or ddc')
+ ..addOption('dart-sdk-summary')
+ ..addMultiOption('input-summary')
+ ..addMultiOption('input-linked')
+ ..addMultiOption('multi-root')
+ ..addOption('multi-root-scheme', defaultsTo: 'org-dartlang-multi-root')
+ ..addOption('libraries-file')
+ ..addOption('packages-file')
+ ..addMultiOption('source')
+ ..addOption('output')
+ ..addFlag('reuse-compiler-result', defaultsTo: false)
+ ..addFlag('use-incremental-compiler', defaultsTo: false)
+ ..addOption('used-inputs')
+ ..addFlag('track-widget-creation', defaultsTo: false)
+ ..addMultiOption('enable-experiment',
+ help: 'Enable a language experiment when invoking the CFE.')
+ ..addMultiOption('define', abbr: 'D')
+ ..addFlag('verbose', defaultsTo: false)
+ ..addFlag('sound-null-safety', defaultsTo: false)
+ ..addOption('verbosity',
+ defaultsTo: fe.Verbosity.defaultValue,
+ help: 'Sets the verbosity level used for filtering messages during '
+ 'compilation.',
+ allowed: fe.Verbosity.allowedValues,
+ allowedHelp: fe.Verbosity.allowedValuesHelp);
+
+class ComputeKernelResult {
+ final bool succeeded;
+ final fe.InitializedCompilerState previousState;
+
+ ComputeKernelResult(this.succeeded, this.previousState);
+}
+
+/// Computes a kernel file based on [args].
+///
+/// If [isWorker] is true then exit codes will not be set on failure.
+///
+/// If [outputBuffer] is provided then messages will be written to that buffer
+/// instead of printed to the console.
+///
+/// Returns whether or not the summary was successfully output.
+Future<ComputeKernelResult> computeKernel(List<String> args,
+ {bool isWorker: false,
+ StringBuffer outputBuffer,
+ Map<Uri, List<int>> inputDigests,
+ fe.InitializedCompilerState previousState}) async {
+ inputDigests ??= <Uri, List<int>>{};
+ dynamic out = outputBuffer ?? stderr;
+ bool succeeded = true;
+
+ var parsedArgs = summaryArgsParser.parse(args);
+
+ if (parsedArgs['help']) {
+ out.writeln(summaryArgsParser.usage);
+ if (!isWorker) exit(0);
+ return new ComputeKernelResult(false, previousState);
+ }
+
+ // Bazel creates an overlay file system where some files may be located in the
+ // source tree, some in a gendir, and some in a bindir. The multi-root file
+ // system hides this from the front end.
+ var multiRoots = parsedArgs['multi-root'].map(Uri.base.resolve).toList();
+ if (multiRoots.isEmpty) multiRoots.add(Uri.base);
+ var fileSystem = new MultiRootFileSystem(parsedArgs['multi-root-scheme'],
+ multiRoots, fe.StandardFileSystem.instance);
+ var sources = (parsedArgs['source'] as List<String>).map(toUri).toList();
+ var excludeNonSources = parsedArgs['exclude-non-sources'] as bool;
+
+ var nnbdMode = parsedArgs['sound-null-safety'] as bool
+ ? fe.NnbdMode.Strong
+ : fe.NnbdMode.Weak;
+ var summaryOnly = parsedArgs['summary-only'] as bool;
+ var trackWidgetCreation = parsedArgs['track-widget-creation'] as bool;
+
+ // TODO(sigmund,jakemac): make target mandatory. We allow null to be backwards
+ // compatible while we migrate existing clients of this tool.
+ var targetName =
+ (parsedArgs['target'] as String) ?? (summaryOnly ? 'ddc' : 'vm');
+ var targetFlags = new TargetFlags(
+ trackWidgetCreation: trackWidgetCreation,
+ enableNullSafety: nnbdMode == fe.NnbdMode.Strong);
+ Target target;
+ switch (targetName) {
+ case 'vm':
+ target = new VmTarget(targetFlags);
+ if (summaryOnly) {
+ out.writeln('error: --summary-only not supported for the vm target');
+ }
+ break;
+ case 'flutter':
+ target = new FlutterTarget(targetFlags);
+ if (summaryOnly) {
+ throw new ArgumentError(
+ 'error: --summary-only not supported for the flutter target');
+ }
+ break;
+ case 'flutter_runner':
+ target = new FlutterRunnerTarget(targetFlags);
+ if (summaryOnly) {
+ throw new ArgumentError('error: --summary-only not supported for the '
+ 'flutter_runner target');
+ }
+ break;
+ case 'dart2js':
+ target = new Dart2jsTarget('dart2js', targetFlags);
+ if (summaryOnly) {
+ out.writeln(
+ 'error: --summary-only not supported for the dart2js target');
+ }
+ break;
+ case 'ddc':
+ // TODO(jakemac):If `generateKernel` changes to return a summary
+ // component, process the component instead.
+ target =
+ new DevCompilerSummaryTarget(sources, excludeNonSources, targetFlags);
+ if (!summaryOnly) {
+ out.writeln('error: --no-summary-only not supported for the '
+ 'ddc target');
+ }
+ break;
+ default:
+ out.writeln('error: unsupported target: $targetName');
+ }
+
+ List<Uri> linkedInputs =
+ (parsedArgs['input-linked'] as List<String>).map(toUri).toList();
+
+ List<Uri> summaryInputs =
+ (parsedArgs['input-summary'] as List<String>).map(toUri).toList();
+
+ fe.InitializedCompilerState state;
+ bool usingIncrementalCompiler = false;
+ bool recordUsedInputs = parsedArgs["used-inputs"] != null;
+ var environmentDefines = _parseEnvironmentDefines(parsedArgs['define']);
+ var verbose = parsedArgs['verbose'] as bool;
+ var verbosity = fe.Verbosity.parseArgument(parsedArgs['verbosity']);
+
+ if (parsedArgs['use-incremental-compiler']) {
+ usingIncrementalCompiler = true;
+
+ // If digests weren't given and if not in worker mode, create fake data and
+ // ensure we don't have a previous state (as that wouldn't be safe with
+ // fake input digests).
+ if (!isWorker && inputDigests.isEmpty) {
+ previousState = null;
+ inputDigests[toUri(parsedArgs['dart-sdk-summary'])] = const [0];
+ for (Uri uri in summaryInputs) {
+ inputDigests[uri] = const [0];
+ }
+ for (Uri uri in linkedInputs) {
+ inputDigests[uri] = const [0];
+ }
+ }
+
+ state = await fe.initializeIncrementalCompiler(
+ previousState,
+ {
+ "target=$targetName",
+ "trackWidgetCreation=$trackWidgetCreation",
+ "multiRootScheme=${fileSystem.markerScheme}",
+ "multiRootRoots=${fileSystem.roots}",
+ },
+ toUri(parsedArgs['dart-sdk-summary']),
+ toUri(parsedArgs['packages-file']),
+ toUri(parsedArgs['libraries-file']),
+ [...summaryInputs, ...linkedInputs],
+ inputDigests,
+ target,
+ fileSystem,
+ (parsedArgs['enable-experiment'] as List<String>),
+ summaryOnly,
+ environmentDefines,
+ trackNeededDillLibraries: recordUsedInputs,
+ verbose: verbose,
+ nnbdMode: nnbdMode);
+ } else {
+ state = await fe.initializeCompiler(
+ // TODO(sigmund): pass an old state once we can make use of it.
+ null,
+ toUri(parsedArgs['dart-sdk-summary']),
+ toUri(parsedArgs['libraries-file']),
+ toUri(parsedArgs['packages-file']),
+ [...summaryInputs, ...linkedInputs],
+ target,
+ fileSystem,
+ parsedArgs['enable-experiment'] as List<String>,
+ environmentDefines,
+ verbose: verbose,
+ nnbdMode: nnbdMode);
+ }
+
+ void onDiagnostic(fe.DiagnosticMessage message) {
+ if (fe.Verbosity.shouldPrint(verbosity, message)) {
+ fe.printDiagnosticMessage(message, out.writeln);
+ }
+ if (message.severity == fe.Severity.error) {
+ succeeded = false;
+ }
+ }
+
+ List<int> kernel;
+ bool wroteUsedDills = false;
+ if (usingIncrementalCompiler) {
+ state.options.onDiagnostic = onDiagnostic;
+ Component incrementalComponent = await state.incrementalCompiler
+ .computeDelta(entryPoints: sources, fullComponent: true);
+
+ if (recordUsedInputs) {
+ Set<Uri> usedOutlines = {};
+ for (Library lib in state.incrementalCompiler.neededDillLibraries) {
+ if (lib.importUri.scheme == "dart") continue;
+ Uri uri = state.libraryToInputDill[lib.importUri];
+ if (uri == null) {
+ throw new StateError("Library ${lib.importUri} was recorded as used, "
+ "but was not in the list of known libraries.");
+ }
+ usedOutlines.add(uri);
+ }
+ var outputUsedFile = new File(parsedArgs["used-inputs"]);
+ outputUsedFile.createSync(recursive: true);
+ outputUsedFile.writeAsStringSync(usedOutlines.join("\n"));
+ wroteUsedDills = true;
+ }
+
+ kernel = await state.incrementalCompiler.context.runInContext((_) {
+ if (summaryOnly) {
+ incrementalComponent.uriToSource.clear();
+ incrementalComponent.problemsAsJson = null;
+ incrementalComponent.setMainMethodAndMode(
+ null, true, incrementalComponent.mode);
+ target.performOutlineTransformations(incrementalComponent);
+ makeStable(incrementalComponent);
+ return Future.value(fe.serializeComponent(incrementalComponent,
+ includeSources: false, includeOffsets: false));
+ }
+
+ makeStable(incrementalComponent);
+
+ return Future.value(fe.serializeComponent(incrementalComponent,
+ filter: excludeNonSources
+ ? (library) => sources.contains(library.importUri)
+ : null,
+ includeOffsets: true));
+ });
+ } else if (summaryOnly) {
+ kernel = await fe.compileSummary(state, sources, onDiagnostic,
+ includeOffsets: false);
+ } else {
+ Component component =
+ await fe.compileComponent(state, sources, onDiagnostic);
+ kernel = fe.serializeComponent(component,
+ filter: excludeNonSources
+ ? (library) => sources.contains(library.importUri)
+ : null,
+ includeOffsets: true);
+ }
+ state.options.onDiagnostic = null; // See http://dartbug.com/36983.
+
+ if (!wroteUsedDills && recordUsedInputs) {
+ // The path taken didn't record inputs used: Say we used everything.
+ var outputUsedFile = new File(parsedArgs["used-inputs"]);
+ outputUsedFile.createSync(recursive: true);
+ Set<Uri> allFiles = {...summaryInputs, ...linkedInputs};
+ outputUsedFile.writeAsStringSync(allFiles.join("\n"));
+ wroteUsedDills = true;
+ }
+
+ if (kernel != null) {
+ var outputFile = new File(parsedArgs['output']);
+ outputFile.createSync(recursive: true);
+ outputFile.writeAsBytesSync(kernel);
+ } else {
+ assert(!succeeded);
+ }
+
+ return new ComputeKernelResult(succeeded, state);
+}
+
+/// Make sure the output is stable by sorting libraries and additional exports.
+void makeStable(Component c) {
+ // Make sure the output is stable.
+ c.libraries.sort((l1, l2) {
+ return "${l1.fileUri}".compareTo("${l2.fileUri}");
+ });
+ c.problemsAsJson?.sort();
+ c.computeCanonicalNames();
+ for (Library library in c.libraries) {
+ library.additionalExports.sort((Reference r1, Reference r2) {
+ return "${r1.canonicalName}".compareTo("${r2.canonicalName}");
+ });
+ library.problemsAsJson?.sort();
+ }
+}
+
+/// Extends the DevCompilerTarget to transform outlines to meet the requirements
+/// of summaries in bazel and package-build.
+///
+/// Build systems like package-build may provide the same input file twice to
+/// the summary worker, but only intends to have it in one output summary. The
+/// convention is that if it is listed as a source, it is intended to be part of
+/// the output, if the source file was loaded as a dependency, then it was
+/// already included in a different summary. The transformation below ensures
+/// that the output summary doesn't include those implicit inputs.
+///
+/// Note: this transformation is destructive and is only intended to be used
+/// when generating summaries.
+class DevCompilerSummaryTarget extends DevCompilerTarget {
+ final List<Uri> sources;
+ final bool excludeNonSources;
+
+ DevCompilerSummaryTarget(
+ this.sources, this.excludeNonSources, TargetFlags targetFlags)
+ : super(targetFlags);
+
+ @override
+ void performOutlineTransformations(Component component) {
+ super.performOutlineTransformations(component);
+ if (!excludeNonSources) return;
+
+ List<Library> libraries = new List.from(component.libraries);
+ component.libraries.clear();
+ Set<Uri> include = sources.toSet();
+ for (var lib in libraries) {
+ if (include.contains(lib.importUri)) {
+ component.libraries.add(lib);
+ } else {
+ // Excluding the library also means that their canonical names will not
+ // be computed as part of serialization, so we need to do that
+ // preemtively here to avoid errors when serializing references to
+ // elements of these libraries.
+ component.root.getChildFromUri(lib.importUri).bindTo(lib.reference);
+ lib.computeCanonicalNames();
+ }
+ }
+ }
+}
+
+Uri toUri(String uriString) {
+ if (uriString == null) return null;
+ // Windows-style paths use '\', so convert them to '/' in case they've been
+ // concatenated with Unix-style paths.
+ return Uri.base.resolve(uriString.replaceAll("\\", "/"));
+}
+
+Map<String, String> _parseEnvironmentDefines(List<String> args) {
+ var environment = <String, String>{};
+
+ for (var arg in args) {
+ var eq = arg.indexOf('=');
+ if (eq <= 0) {
+ var kind = eq == 0 ? 'name' : 'value';
+ throw FormatException('no $kind given to -D option `$arg`');
+ }
+ var name = arg.substring(0, eq);
+ var value = arg.substring(eq + 1);
+ environment[name] = value;
+ }
+
+ return environment;
+}
diff --git a/pkg/frontend_server/pubspec.yaml b/pkg/frontend_server/pubspec.yaml
index 7932dab..504c493 100644
--- a/pkg/frontend_server/pubspec.yaml
+++ b/pkg/frontend_server/pubspec.yaml
@@ -8,6 +8,10 @@
dependencies:
args: ^1.4.4
+ build_integration:
+ path: ../build_integration
+ compiler:
+ path: ../compiler
dev_compiler:
path: ../dev_compiler
front_end:
diff --git a/pkg/test_runner/lib/src/static_error.dart b/pkg/test_runner/lib/src/static_error.dart
index bf3571a..397ebad 100644
--- a/pkg/test_runner/lib/src/static_error.dart
+++ b/pkg/test_runner/lib/src/static_error.dart
@@ -455,15 +455,23 @@
/// Matches an explicit error location with a length, like:
///
/// // [error line 1, column 17, length 3]
- static final _explicitLocationAndLengthRegExp =
- RegExp(r"^\s*//\s*\[\s*error line\s+(\d+)\s*,\s*column\s+(\d+)\s*,\s*"
- r"length\s+(\d+)\s*\]\s*$");
+ ///
+ /// or implicitly on the previous line
+ ///
+ /// // [error column 17, length 3]
+ static final _explicitLocationAndLengthRegExp = RegExp(
+ r"^\s*//\s*\[\s*error (?:line\s+(\d+)\s*,)?\s*column\s+(\d+)\s*,\s*"
+ r"length\s+(\d+)\s*\]\s*$");
/// Matches an explicit error location without a length, like:
///
/// // [error line 1, column 17]
- static final _explicitLocationRegExp =
- RegExp(r"^\s*//\s*\[\s*error line\s+(\d+)\s*,\s*column\s+(\d+)\s*\]\s*$");
+ ///
+ /// or implicitly on the previous line.
+ ///
+ /// // [error column 17]
+ static final _explicitLocationRegExp = RegExp(
+ r"^\s*//\s*\[\s*error (?:line\s+(\d+)\s*,)?\s*column\s+(\d+)\s*\]\s*$");
/// Matches the beginning of an error message, like `// [analyzer]`.
///
@@ -518,25 +526,28 @@
_parseErrors(
line: _lastRealLine,
column: sourceLine.indexOf("^") + 1,
- length: match.group(1).length);
+ length: match[1].length);
_advance();
continue;
}
match = _explicitLocationAndLengthRegExp.firstMatch(sourceLine);
if (match != null) {
+ var lineCapture = match[1];
_parseErrors(
- line: int.parse(match.group(1)),
- column: int.parse(match.group(2)),
- length: int.parse(match.group(3)));
+ line: lineCapture == null ? _lastRealLine : int.parse(lineCapture),
+ column: int.parse(match[2]),
+ length: int.parse(match[3]));
_advance();
continue;
}
match = _explicitLocationRegExp.firstMatch(sourceLine);
if (match != null) {
+ var lineCapture = match[1];
_parseErrors(
- line: int.parse(match.group(1)), column: int.parse(match.group(2)));
+ line: lineCapture == null ? _lastRealLine : int.parse(lineCapture),
+ column: int.parse(match[2]));
_advance();
continue;
}
@@ -559,16 +570,16 @@
var match = _errorMessageRegExp.firstMatch(_peek(1));
if (match == null) break;
- var number = match.group(2) != null ? int.parse(match.group(2)) : null;
+ var number = match[2] != null ? int.parse(match[2]) : null;
- var sourceName = match.group(1);
+ var sourceName = match[1];
var source = ErrorSource.find(sourceName);
if (source == null) _fail("Unknown front end '[$sourceName]'.");
if (source == ErrorSource.context && number == null) {
_fail("Context messages must have an error number.");
}
- var message = match.group(3);
+ var message = match[3];
_advance();
var sourceLines = {locationLine, _currentLine};
@@ -587,7 +598,7 @@
var messageMatch = _errorMessageRestRegExp.firstMatch(nextLine);
if (messageMatch == null) break;
- message += "\n" + messageMatch.group(1);
+ message += "\n" + messageMatch[1];
_advance();
sourceLines.add(_currentLine);
}
diff --git a/pkg/test_runner/lib/src/update_errors.dart b/pkg/test_runner/lib/src/update_errors.dart
index 7ef97fe..b4b53ef 100644
--- a/pkg/test_runner/lib/src/update_errors.dart
+++ b/pkg/test_runner/lib/src/update_errors.dart
@@ -85,19 +85,12 @@
// Rebuild the source file a line at a time.
var previousIndent = 0;
- var codeLine = 1;
var result = <String>[];
for (var i = 0; i < lines.length; i++) {
// Keep the code.
if (lines[i] != null) {
result.add(lines[i]);
previousIndent = _countIndentation(lines[i]);
-
- // Keep track of the resulting line number of the last line containing
- // real code. We use this when outputting explicit line numbers instead
- // the error's reported line to compensate for added or removed lines
- // above the error.
- codeLine = result.length;
}
// Add expectations for any errors reported on this line.
@@ -124,13 +117,13 @@
error.length != null &&
error.length != previousLength)) {
// If the error can't fit in a line comment, or no source location is
- // sepcified, use an explicit location.
+ // specified, use an explicit location.
if (error.column <= 2 || error.length == 0) {
if (error.length == null) {
- result.add("$comment [error line $codeLine, column "
+ result.add("$comment [error column "
"${error.column}]");
} else {
- result.add("$comment [error line $codeLine, column "
+ result.add("$comment [error column "
"${error.column}, length ${error.length}]");
}
} else {
diff --git a/pkg/test_runner/test/update_errors_test.dart b/pkg/test_runner/test/update_errors_test.dart
index afe5db9..365ed14 100644
--- a/pkg/test_runner/test/update_errors_test.dart
+++ b/pkg/test_runner/test/update_errors_test.dart
@@ -268,12 +268,12 @@
], expected: """
int i =
"bad";
-/\/ [error line 2, column 1, length 5]
+/\/ [error column 1, length 5]
/\/ [analyzer] updated.error
int j =
"bad";
-/\/ [error line 7, column 1, length 5]
+/\/ [error column 1, length 5]
/\/ [cfe] Error.
""");
@@ -293,7 +293,7 @@
""", errors: [makeError(line: 2, column: 1, cfeError: "Error.")], expected: """
int i =
"bad";
-/\/ [error line 2, column 1]
+/\/ [error column 1]
/\/ [cfe] Error.
""");
@@ -314,9 +314,9 @@
main() {
}
Error here;
-/\/ [error line 3, column 1, length 5]
+/\/ [error column 1, length 5]
/\/ [analyzer] NEW.ERROR
-/\/ [error line 3, column 2, length 3]
+/\/ [error column 2, length 3]
/\/ [cfe] Error.
""");
@@ -400,7 +400,7 @@
makeError(line: 1, column: 1, length: 0, cfeError: "Foo"),
], expected: """
x
-// [error line 1, column 1, length 0]
+// [error column 1, length 0]
// [cfe] Foo""");
contextMessages();
diff --git a/runtime/lib/string.cc b/runtime/lib/string.cc
index 996d92d..9fb91ee 100644
--- a/runtime/lib/string.cc
+++ b/runtime/lib/string.cc
@@ -257,35 +257,6 @@
return OneByteString::New(receiver, start, end - start, Heap::kNew);
}
-// This is high-performance code.
-DEFINE_NATIVE_ENTRY(OneByteString_splitWithCharCode, 0, 2) {
- const String& receiver =
- String::CheckedHandle(zone, arguments->NativeArgAt(0));
- ASSERT(receiver.IsOneByteString());
- GET_NON_NULL_NATIVE_ARGUMENT(Smi, smi_split_code, arguments->NativeArgAt(1));
- const intptr_t len = receiver.Length();
- const intptr_t split_code = smi_split_code.Value();
- const GrowableObjectArray& result = GrowableObjectArray::Handle(
- zone, GrowableObjectArray::New(16, Heap::kNew));
- String& str = String::Handle(zone);
- intptr_t start = 0;
- intptr_t i = 0;
- for (; i < len; i++) {
- if (split_code == OneByteString::CharAt(receiver, i)) {
- str = OneByteString::SubStringUnchecked(receiver, start, (i - start),
- Heap::kNew);
- result.Add(str);
- start = i + 1;
- }
- }
- str = OneByteString::SubStringUnchecked(receiver, start, (i - start),
- Heap::kNew);
- result.Add(str);
- result.SetTypeArguments(TypeArguments::Handle(
- zone, isolate->group()->object_store()->type_argument_string()));
- return result.ptr();
-}
-
DEFINE_NATIVE_ENTRY(Internal_allocateOneByteString, 0, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(Integer, length_obj, arguments->NativeArgAt(0));
const int64_t length = length_obj.AsInt64Value();
diff --git a/runtime/observatory_2/tests/service_2/get_allocation_samples_test.dart b/runtime/observatory_2/tests/service_2/get_allocation_samples_test.dart
index 0b0e237..dac054c6 100644
--- a/runtime/observatory_2/tests/service_2/get_allocation_samples_test.dart
+++ b/runtime/observatory_2/tests/service_2/get_allocation_samples_test.dart
@@ -70,7 +70,6 @@
'Root',
'[Unoptimized] test',
'[Unoptimized] test',
- '[Unoptimized] _Closure.call',
'[Unoptimized] _ServiceTesteeRunner.run',
];
for (var i = 0; i < expected.length; i++) {
diff --git a/runtime/observatory_2/tests/service_2/get_allocation_traces_test.dart b/runtime/observatory_2/tests/service_2/get_allocation_traces_test.dart
index dadf082..2334658 100644
--- a/runtime/observatory_2/tests/service_2/get_allocation_traces_test.dart
+++ b/runtime/observatory_2/tests/service_2/get_allocation_traces_test.dart
@@ -89,7 +89,6 @@
'Root',
'[Unoptimized] test',
'[Unoptimized] test',
- '[Unoptimized] _Closure.call',
'[Unoptimized] _ServiceTesteeRunner.run',
];
for (var i = 0; i < expected.length; i++) {
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index 359d482..373dffb 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -130,7 +130,6 @@
V(StringBase_joinReplaceAllResult, 4) \
V(StringBuffer_createStringFromUint16Array, 3) \
V(OneByteString_substringUnchecked, 3) \
- V(OneByteString_splitWithCharCode, 2) \
V(OneByteString_allocateFromOneByteList, 3) \
V(TwoByteString_allocateFromTwoByteList, 3) \
V(String_getHashCode, 1) \
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index d748f67..869d90c 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -3318,7 +3318,8 @@
Fragment StreamingFlowGraphBuilder::BuildFunctionInvocation(TokenPosition* p) {
const intptr_t offset = ReaderOffset() - 1; // Include the tag.
- ReadByte(); // read kind.
+ const FunctionAccessKind function_access_kind =
+ static_cast<FunctionAccessKind>(ReadByte()); // read kind.
const TokenPosition position = ReadPosition(); // read position.
if (p != nullptr) *p = position;
@@ -3328,8 +3329,9 @@
call_site_attributes_metadata_helper_.GetCallSiteAttributes(offset);
const bool is_unchecked_closure_call =
- (call_site_attributes.receiver_type != nullptr) &&
- call_site_attributes.receiver_type->IsFunctionType();
+ ((call_site_attributes.receiver_type != nullptr) &&
+ call_site_attributes.receiver_type->IsFunctionType()) ||
+ (function_access_kind == FunctionAccessKind::kFunctionType);
Fragment instructions;
instructions += BuildExpression(); // read receiver.
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph_test.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph_test.cc
index a688d7c..1bd0f27 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph_test.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph_test.cc
@@ -288,4 +288,56 @@
EXPECT(call_add->entry_kind() == Code::EntryKind::kUnchecked);
}
+ISOLATE_UNIT_TEST_CASE(StreamingFlowGraphBuilder_TypedClosureCall) {
+ // This test ensures that a typed closure call (i.e. the closure being called
+ // has a real function type as static type) ends up compiling to
+ //
+ // CheckNull()+ClosureCall()
+ //
+ // instead of
+ //
+ // InstanceCall(dyn:call)
+ //
+ // This is a regression test for a case where JIT support uses dynamic calls
+ // instead of typed closure calls if call-site attribute metadata is missing
+ // which is the case if an incremental kernel compiler is used. The
+ // [LoadTestScript] below uses IKG compiler, so this is a regression test for:
+ //
+ // - https://github.com/dart-lang/sdk/issues/46320
+ // - https://github.com/dart-lang/sdk/issues/45421
+ //
+ const char* kScript = R"(
+ int callClosure(int Function(int) fun, int value) => fun(value);
+ test() => callClosure((int a) => a + 1, 10);
+ )";
+
+ const auto& root_library = Library::Handle(LoadTestScript(kScript));
+ Invoke(root_library, "test");
+
+ const auto& callClosureFunction =
+ Function::Handle(GetFunction(root_library, "callClosure"));
+ TestPipeline pipeline(callClosureFunction, CompilerPass::kJIT);
+ FlowGraph* flow_graph = pipeline.RunPasses({
+ CompilerPass::kComputeSSA,
+ });
+
+ auto entry = flow_graph->graph_entry()->normal_entry();
+ EXPECT(entry != nullptr);
+
+ ILMatcher cursor(flow_graph, entry, true);
+ // clang-format off
+ RELEASE_ASSERT(cursor.TryMatch({
+ kMatchAndMoveFunctionEntry,
+ kMatchAndMoveCheckStackOverflow,
+ kMoveDebugStepChecks,
+ kMatchAndMoveCheckNull,
+ kMatchAndMoveLoadField,
+ kMoveDebugStepChecks,
+ kMatchAndMoveClosureCall,
+ kMoveDebugStepChecks,
+ kMatchReturn,
+ }));
+ // clang-format on
+}
+
} // namespace dart
diff --git a/runtime/vm/compiler/frontend/kernel_fingerprints.cc b/runtime/vm/compiler/frontend/kernel_fingerprints.cc
index 33b39af..4b0426c 100644
--- a/runtime/vm/compiler/frontend/kernel_fingerprints.cc
+++ b/runtime/vm/compiler/frontend/kernel_fingerprints.cc
@@ -480,7 +480,7 @@
SkipDartType(); // read function_type.
return;
case kFunctionInvocation:
- ReadByte(); // read kind.
+ BuildHash(ReadByte()); // read kind.
ReadPosition(); // read position.
CalculateExpressionFingerprint(); // read receiver.
CalculateArgumentsFingerprint(); // read arguments.
diff --git a/runtime/vm/compiler/recognized_methods_list.h b/runtime/vm/compiler/recognized_methods_list.h
index 28eecaf..4c4af85 100644
--- a/runtime/vm/compiler/recognized_methods_list.h
+++ b/runtime/vm/compiler/recognized_methods_list.h
@@ -200,8 +200,8 @@
V(::, reachabilityFence, ReachabilityFence, 0x619235c1) \
V(_Utf8Decoder, _scan, Utf8DecoderScan, 0x1dcaf73d) \
V(_Future, timeout, FutureTimeout, 0x73041520) \
- V(Future, wait, FutureWait, 0xa05d5e7b) \
- V(_RootZone, runUnary, RootZoneRunUnary, 0xa22248b6) \
+ V(Future, wait, FutureWait, 0x495c83cd) \
+ V(_RootZone, runUnary, RootZoneRunUnary, 0xb607f8bf) \
V(_FutureListener, handleValue, FutureListenerHandleValue, 0x438115a8) \
V(::, has63BitSmis, Has63BitSmis, 0xf61b5ab2) \
@@ -438,13 +438,13 @@
#define RECOGNIZED_LIST_FACTORY_LIST(V) \
V(_ListFactory, _List, ., kArrayCid, 0xd693eee6) \
V(_ListFilledFactory, _List, .filled, kArrayCid, 0x7f29060d) \
- V(_ListGenerateFactory, _List, .generate, kArrayCid, 0xa1e6b785) \
+ V(_ListGenerateFactory, _List, .generate, kArrayCid, 0x95feb438) \
V(_GrowableListFactory, _GrowableList, ., kGrowableObjectArrayCid, \
0xc1b55e71) \
V(_GrowableListFilledFactory, _GrowableList, .filled, \
kGrowableObjectArrayCid, 0x37d0dc65) \
V(_GrowableListGenerateFactory, _GrowableList, .generate, \
- kGrowableObjectArrayCid, 0xc0c5682d) \
+ kGrowableObjectArrayCid, 0x52f61890) \
V(_GrowableListWithData, _GrowableList, ._withData, kGrowableObjectArrayCid, \
0xa32d060b) \
V(_Int8ArrayFactory, Int8List, ., kTypedDataInt8ArrayCid, 0x660dd888) \
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index de6a837..70256cf 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -4511,7 +4511,7 @@
"vmName\":\"\",\"location\":{\"type\":\"SourceLocation\",\"script\":{"
"\"type\":\"@Script\",\"fixedId\":true,\"id\":\"\",\"uri\":\"dart:core-"
"patch\\/string_patch.dart\",\"_kind\":\"kernel\"},\"tokenPos\":32310,"
- "\"endTokenPos\":44332},\"library\":{\"type\":\"@Library\",\"fixedId\":"
+ "\"endTokenPos\":44599},\"library\":{\"type\":\"@Library\",\"fixedId\":"
"true,\"id\":\"\",\"name\":\"dart.core\",\"uri\":\"dart:core\"}},"
"\"identityHashCode\":0,\"kind\":\"String\",\"id\":\"\",\"length\":2,"
"\"valueAsString\":\"dw\"}",
diff --git a/sdk/lib/_internal/vm/lib/string_patch.dart b/sdk/lib/_internal/vm/lib/string_patch.dart
index a8b949a..be6b858 100644
--- a/sdk/lib/_internal/vm/lib/string_patch.dart
+++ b/sdk/lib/_internal/vm/lib/string_patch.dart
@@ -985,8 +985,19 @@
String _substringUncheckedNative(int startIndex, int endIndex)
native "OneByteString_substringUnchecked";
- List<String> _splitWithCharCode(int charCode)
- native "OneByteString_splitWithCharCode";
+ List<String> _splitWithCharCode(int charCode) {
+ final parts = <String>[];
+ int i = 0;
+ int start = 0;
+ for (i = 0; i < this.length; ++i) {
+ if (this.codeUnitAt(i) == charCode) {
+ parts.add(this._substringUnchecked(start, i));
+ start = i + 1;
+ }
+ }
+ parts.add(this._substringUnchecked(start, i));
+ return parts;
+ }
List<String> split(Pattern pattern) {
// TODO(vegorov) investigate if this can be rewritten as `is _OneByteString`
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index 131b66a..4851883 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -435,6 +435,11 @@
/// Use the callbacks, for example, for pausing the underlying subscription
/// while having no subscribers to prevent losing events, or canceling the
/// subscription when there are no listeners.
+ ///
+ /// Cancelling is intended to be used when there are no current subscribers.
+ /// If the subscription passed to `onListen` or `onCancel` is cancelled,
+ /// then no further events are ever emitted by current subscriptions on
+ /// the returned broadcast stream, not even a done event.
Stream<T> asBroadcastStream(
{void onListen(StreamSubscription<T> subscription)?,
void onCancel(StreamSubscription<T> subscription)?}) {
diff --git a/tools/VERSION b/tools/VERSION
index 665452b..21694021 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 14
PATCH 0
-PRERELEASE 210
+PRERELEASE 211
PRERELEASE_PATCH 0
\ No newline at end of file
diff --git a/utils/bazel/kernel_worker.dart b/utils/bazel/kernel_worker.dart
index 96f1e9a..3e68ac6 100644
--- a/utils/bazel/kernel_worker.dart
+++ b/utils/bazel/kernel_worker.dart
@@ -15,17 +15,9 @@
import 'dart:io';
import 'dart:isolate';
-import 'package:args/args.dart';
import 'package:bazel_worker/bazel_worker.dart';
-import 'package:build_integration/file_system/multi_root.dart';
-import 'package:dev_compiler/src/kernel/target.dart';
import 'package:front_end/src/api_unstable/bazel_worker.dart' as fe;
-import 'package:kernel/ast.dart' show Component, Library, Reference;
-import 'package:kernel/target/targets.dart';
-import 'package:vm/target/vm.dart';
-import 'package:vm/target/flutter.dart';
-import 'package:vm/target/flutter_runner.dart';
-import 'package:compiler/src/kernel/dart2js_target.dart';
+import 'package:frontend_server/compute_kernel.dart';
/// [sendPort] may be passed in when started in an isolate. If provided, it is
/// used for bazel worker communication instead of stdin/stdout.
@@ -68,10 +60,17 @@
} else {
previousState = null;
}
+
+ /// Build a map of uris to digests.
+ final inputDigests = <Uri, List<int>>{};
+ for (var input in request.inputs) {
+ inputDigests[toUri(input.path)] = input.digest;
+ }
+
var result = await computeKernel(request.arguments,
isWorker: true,
outputBuffer: outputBuffer,
- inputs: request.inputs,
+ inputDigests: inputDigests,
previousState: previousStateToPass);
previousState = result.previousState;
if (!result.succeeded) {
@@ -86,413 +85,3 @@
return response;
}
}
-
-/// If the last arg starts with `@`, this reads the file it points to and treats
-/// each line as an additional arg.
-///
-/// This is how individual work request args are differentiated from startup
-/// args in bazel (inidividual work request args go in that file).
-List<String> preprocessArgs(List<String> args) {
- args = new List.from(args);
- if (args.isEmpty) {
- return args;
- }
- String lastArg = args.last;
- if (lastArg.startsWith('@')) {
- File argsFile = new File(lastArg.substring(1));
- try {
- args.removeLast();
- args.addAll(argsFile.readAsLinesSync());
- } on FileSystemException catch (e) {
- throw new Exception('Failed to read file specified by $lastArg : $e');
- }
- }
- return args;
-}
-
-/// An [ArgParser] for generating kernel summaries.
-final summaryArgsParser = new ArgParser()
- ..addFlag('help', negatable: false, abbr: 'h')
- ..addFlag('exclude-non-sources',
- negatable: false,
- help: 'Whether source files loaded implicitly should be included as '
- 'part of the summary.')
- ..addFlag('summary-only',
- defaultsTo: true,
- negatable: true,
- help: 'Whether to only build summary files.')
- ..addOption('target',
- allowed: const [
- 'vm',
- 'flutter',
- 'flutter_runner',
- 'dart2js',
- 'ddc',
- ],
- help: 'Build kernel for the vm, flutter, flutter_runner, dart2js or ddc')
- ..addOption('dart-sdk-summary')
- ..addMultiOption('input-summary')
- ..addMultiOption('input-linked')
- ..addMultiOption('multi-root')
- ..addOption('multi-root-scheme', defaultsTo: 'org-dartlang-multi-root')
- ..addOption('libraries-file')
- ..addOption('packages-file')
- ..addMultiOption('source')
- ..addOption('output')
- ..addFlag('reuse-compiler-result', defaultsTo: false)
- ..addFlag('use-incremental-compiler', defaultsTo: false)
- ..addOption('used-inputs')
- ..addFlag('track-widget-creation', defaultsTo: false)
- ..addMultiOption('enable-experiment',
- help: 'Enable a language experiment when invoking the CFE.')
- ..addMultiOption('define', abbr: 'D')
- ..addFlag('verbose', defaultsTo: false)
- ..addFlag('sound-null-safety', defaultsTo: false)
- ..addOption('verbosity',
- defaultsTo: fe.Verbosity.defaultValue,
- help: 'Sets the verbosity level used for filtering messages during '
- 'compilation.',
- allowed: fe.Verbosity.allowedValues,
- allowedHelp: fe.Verbosity.allowedValuesHelp);
-
-class ComputeKernelResult {
- final bool succeeded;
- final fe.InitializedCompilerState previousState;
-
- ComputeKernelResult(this.succeeded, this.previousState);
-}
-
-/// Computes a kernel file based on [args].
-///
-/// If [isWorker] is true then exit codes will not be set on failure.
-///
-/// If [outputBuffer] is provided then messages will be written to that buffer
-/// instead of printed to the console.
-///
-/// Returns whether or not the summary was successfully output.
-Future<ComputeKernelResult> computeKernel(List<String> args,
- {bool isWorker: false,
- StringBuffer outputBuffer,
- Iterable<Input> inputs,
- fe.InitializedCompilerState previousState}) async {
- dynamic out = outputBuffer ?? stderr;
- bool succeeded = true;
-
- var parsedArgs = summaryArgsParser.parse(args);
-
- if (parsedArgs['help']) {
- out.writeln(summaryArgsParser.usage);
- if (!isWorker) exit(0);
- return new ComputeKernelResult(false, previousState);
- }
-
- // Bazel creates an overlay file system where some files may be located in the
- // source tree, some in a gendir, and some in a bindir. The multi-root file
- // system hides this from the front end.
- var multiRoots = parsedArgs['multi-root'].map(Uri.base.resolve).toList();
- if (multiRoots.isEmpty) multiRoots.add(Uri.base);
- var fileSystem = new MultiRootFileSystem(parsedArgs['multi-root-scheme'],
- multiRoots, fe.StandardFileSystem.instance);
- var sources = (parsedArgs['source'] as List<String>).map(_toUri).toList();
- var excludeNonSources = parsedArgs['exclude-non-sources'] as bool;
-
- var nnbdMode = parsedArgs['sound-null-safety'] as bool
- ? fe.NnbdMode.Strong
- : fe.NnbdMode.Weak;
- var summaryOnly = parsedArgs['summary-only'] as bool;
- var trackWidgetCreation = parsedArgs['track-widget-creation'] as bool;
-
- // TODO(sigmund,jakemac): make target mandatory. We allow null to be backwards
- // compatible while we migrate existing clients of this tool.
- var targetName =
- (parsedArgs['target'] as String) ?? (summaryOnly ? 'ddc' : 'vm');
- var targetFlags = new TargetFlags(
- trackWidgetCreation: trackWidgetCreation,
- enableNullSafety: nnbdMode == fe.NnbdMode.Strong);
- Target target;
- switch (targetName) {
- case 'vm':
- target = new VmTarget(targetFlags);
- if (summaryOnly) {
- out.writeln('error: --summary-only not supported for the vm target');
- }
- break;
- case 'flutter':
- target = new FlutterTarget(targetFlags);
- if (summaryOnly) {
- throw new ArgumentError(
- 'error: --summary-only not supported for the flutter target');
- }
- break;
- case 'flutter_runner':
- target = new FlutterRunnerTarget(targetFlags);
- if (summaryOnly) {
- throw new ArgumentError('error: --summary-only not supported for the '
- 'flutter_runner target');
- }
- break;
- case 'dart2js':
- target = new Dart2jsTarget('dart2js', targetFlags);
- if (summaryOnly) {
- out.writeln(
- 'error: --summary-only not supported for the dart2js target');
- }
- break;
- case 'ddc':
- // TODO(jakemac):If `generateKernel` changes to return a summary
- // component, process the component instead.
- target =
- new DevCompilerSummaryTarget(sources, excludeNonSources, targetFlags);
- if (!summaryOnly) {
- out.writeln('error: --no-summary-only not supported for the '
- 'ddc target');
- }
- break;
- default:
- out.writeln('error: unsupported target: $targetName');
- }
-
- List<Uri> linkedInputs =
- (parsedArgs['input-linked'] as List<String>).map(_toUri).toList();
-
- List<Uri> summaryInputs =
- (parsedArgs['input-summary'] as List<String>).map(_toUri).toList();
-
- fe.InitializedCompilerState state;
- bool usingIncrementalCompiler = false;
- bool recordUsedInputs = parsedArgs["used-inputs"] != null;
- var environmentDefines = _parseEnvironmentDefines(parsedArgs['define']);
- var verbose = parsedArgs['verbose'] as bool;
- var verbosity = fe.Verbosity.parseArgument(parsedArgs['verbosity']);
-
- if (parsedArgs['use-incremental-compiler']) {
- usingIncrementalCompiler = true;
-
- /// Build a map of uris to digests.
- final inputDigests = <Uri, List<int>>{};
- if (inputs != null) {
- for (var input in inputs) {
- inputDigests[_toUri(input.path)] = input.digest;
- }
- }
-
- // If digests weren't given and if not in worker mode, create fake data and
- // ensure we don't have a previous state (as that wouldn't be safe with
- // fake input digests).
- if (!isWorker && inputDigests.isEmpty) {
- previousState = null;
- inputDigests[_toUri(parsedArgs['dart-sdk-summary'])] = const [0];
- for (Uri uri in summaryInputs) {
- inputDigests[uri] = const [0];
- }
- for (Uri uri in linkedInputs) {
- inputDigests[uri] = const [0];
- }
- }
-
- state = await fe.initializeIncrementalCompiler(
- previousState,
- {
- "target=$targetName",
- "trackWidgetCreation=$trackWidgetCreation",
- "multiRootScheme=${fileSystem.markerScheme}",
- "multiRootRoots=${fileSystem.roots}",
- },
- _toUri(parsedArgs['dart-sdk-summary']),
- _toUri(parsedArgs['packages-file']),
- _toUri(parsedArgs['libraries-file']),
- [...summaryInputs, ...linkedInputs],
- inputDigests,
- target,
- fileSystem,
- (parsedArgs['enable-experiment'] as List<String>),
- summaryOnly,
- environmentDefines,
- trackNeededDillLibraries: recordUsedInputs,
- verbose: verbose,
- nnbdMode: nnbdMode);
- } else {
- state = await fe.initializeCompiler(
- // TODO(sigmund): pass an old state once we can make use of it.
- null,
- _toUri(parsedArgs['dart-sdk-summary']),
- _toUri(parsedArgs['libraries-file']),
- _toUri(parsedArgs['packages-file']),
- [...summaryInputs, ...linkedInputs],
- target,
- fileSystem,
- parsedArgs['enable-experiment'] as List<String>,
- environmentDefines,
- verbose: verbose,
- nnbdMode: nnbdMode);
- }
-
- void onDiagnostic(fe.DiagnosticMessage message) {
- if (fe.Verbosity.shouldPrint(verbosity, message)) {
- fe.printDiagnosticMessage(message, out.writeln);
- }
- if (message.severity == fe.Severity.error) {
- succeeded = false;
- }
- }
-
- List<int> kernel;
- bool wroteUsedDills = false;
- if (usingIncrementalCompiler) {
- state.options.onDiagnostic = onDiagnostic;
- Component incrementalComponent = await state.incrementalCompiler
- .computeDelta(entryPoints: sources, fullComponent: true);
-
- if (recordUsedInputs) {
- Set<Uri> usedOutlines = {};
- for (Library lib in state.incrementalCompiler.neededDillLibraries) {
- if (lib.importUri.scheme == "dart") continue;
- Uri uri = state.libraryToInputDill[lib.importUri];
- if (uri == null) {
- throw new StateError("Library ${lib.importUri} was recorded as used, "
- "but was not in the list of known libraries.");
- }
- usedOutlines.add(uri);
- }
- var outputUsedFile = new File(parsedArgs["used-inputs"]);
- outputUsedFile.createSync(recursive: true);
- outputUsedFile.writeAsStringSync(usedOutlines.join("\n"));
- wroteUsedDills = true;
- }
-
- kernel = await state.incrementalCompiler.context.runInContext((_) {
- if (summaryOnly) {
- incrementalComponent.uriToSource.clear();
- incrementalComponent.problemsAsJson = null;
- incrementalComponent.setMainMethodAndMode(
- null, true, incrementalComponent.mode);
- target.performOutlineTransformations(incrementalComponent);
- makeStable(incrementalComponent);
- return Future.value(fe.serializeComponent(incrementalComponent,
- includeSources: false, includeOffsets: false));
- }
-
- makeStable(incrementalComponent);
-
- return Future.value(fe.serializeComponent(incrementalComponent,
- filter: excludeNonSources
- ? (library) => sources.contains(library.importUri)
- : null,
- includeOffsets: true));
- });
- } else if (summaryOnly) {
- kernel = await fe.compileSummary(state, sources, onDiagnostic,
- includeOffsets: false);
- } else {
- Component component =
- await fe.compileComponent(state, sources, onDiagnostic);
- kernel = fe.serializeComponent(component,
- filter: excludeNonSources
- ? (library) => sources.contains(library.importUri)
- : null,
- includeOffsets: true);
- }
- state.options.onDiagnostic = null; // See http://dartbug.com/36983.
-
- if (!wroteUsedDills && recordUsedInputs) {
- // The path taken didn't record inputs used: Say we used everything.
- var outputUsedFile = new File(parsedArgs["used-inputs"]);
- outputUsedFile.createSync(recursive: true);
- Set<Uri> allFiles = {...summaryInputs, ...linkedInputs};
- outputUsedFile.writeAsStringSync(allFiles.join("\n"));
- wroteUsedDills = true;
- }
-
- if (kernel != null) {
- var outputFile = new File(parsedArgs['output']);
- outputFile.createSync(recursive: true);
- outputFile.writeAsBytesSync(kernel);
- } else {
- assert(!succeeded);
- }
-
- return new ComputeKernelResult(succeeded, state);
-}
-
-/// Make sure the output is stable by sorting libraries and additional exports.
-void makeStable(Component c) {
- // Make sure the output is stable.
- c.libraries.sort((l1, l2) {
- return "${l1.fileUri}".compareTo("${l2.fileUri}");
- });
- c.problemsAsJson?.sort();
- c.computeCanonicalNames();
- for (Library library in c.libraries) {
- library.additionalExports.sort((Reference r1, Reference r2) {
- return "${r1.canonicalName}".compareTo("${r2.canonicalName}");
- });
- library.problemsAsJson?.sort();
- }
-}
-
-/// Extends the DevCompilerTarget to transform outlines to meet the requirements
-/// of summaries in bazel and package-build.
-///
-/// Build systems like package-build may provide the same input file twice to
-/// the summary worker, but only intends to have it in one output summary. The
-/// convention is that if it is listed as a source, it is intended to be part of
-/// the output, if the source file was loaded as a dependency, then it was
-/// already included in a different summary. The transformation below ensures
-/// that the output summary doesn't include those implicit inputs.
-///
-/// Note: this transformation is destructive and is only intended to be used
-/// when generating summaries.
-class DevCompilerSummaryTarget extends DevCompilerTarget {
- final List<Uri> sources;
- final bool excludeNonSources;
-
- DevCompilerSummaryTarget(
- this.sources, this.excludeNonSources, TargetFlags targetFlags)
- : super(targetFlags);
-
- @override
- void performOutlineTransformations(Component component) {
- super.performOutlineTransformations(component);
- if (!excludeNonSources) return;
-
- List<Library> libraries = new List.from(component.libraries);
- component.libraries.clear();
- Set<Uri> include = sources.toSet();
- for (var lib in libraries) {
- if (include.contains(lib.importUri)) {
- component.libraries.add(lib);
- } else {
- // Excluding the library also means that their canonical names will not
- // be computed as part of serialization, so we need to do that
- // preemtively here to avoid errors when serializing references to
- // elements of these libraries.
- component.root.getChildFromUri(lib.importUri).bindTo(lib.reference);
- lib.computeCanonicalNames();
- }
- }
- }
-}
-
-Uri _toUri(String uriString) {
- if (uriString == null) return null;
- // Windows-style paths use '\', so convert them to '/' in case they've been
- // concatenated with Unix-style paths.
- return Uri.base.resolve(uriString.replaceAll("\\", "/"));
-}
-
-Map<String, String> _parseEnvironmentDefines(List<String> args) {
- var environment = <String, String>{};
-
- for (var arg in args) {
- var eq = arg.indexOf('=');
- if (eq <= 0) {
- var kind = eq == 0 ? 'name' : 'value';
- throw FormatException('no $kind given to -D option `$arg`');
- }
- var name = arg.substring(0, eq);
- var value = arg.substring(eq + 1);
- environment[name] = value;
- }
-
- return environment;
-}