[kernel] Fix NoSuchMethod errors for generic functions.
Bug:
Change-Id: I8ad90e34a7b1f77b29f1d711f158bcb69f5928f4
Reviewed-on: https://dart-review.googlesource.com/17941
Commit-Queue: Samir Jindel <sjindel@google.com>
Reviewed-by: RΓ©gis Crelier <regis@google.com>
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_outline_shaker.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_outline_shaker.dart
index 2c5f2c2..aa31746 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_outline_shaker.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_outline_shaker.dart
@@ -577,7 +577,7 @@
markMember(coreTypes.awaitHelperProcedure);
// These are needed by the mixin transformer
- markMember(coreTypes.invocationMirrorDefaultConstructor);
+ markMember(coreTypes.invocationMirrorWithoutTypeConstructor);
markMember(coreTypes.listFromConstructor);
}
diff --git a/pkg/front_end/testcases/accessors.dart.direct.expect b/pkg/front_end/testcases/accessors.dart.direct.expect
index 845c6cd..6df3a5a 100644
--- a/pkg/front_end/testcases/accessors.dart.direct.expect
+++ b/pkg/front_end/testcases/accessors.dart.direct.expect
@@ -39,7 +39,7 @@
}
static method main() → dynamic {
try {
- core::print(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#onlySetter, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{})));
+ core::print(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#onlySetter, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{})));
throw "No error thrown";
}
on core::NoSuchMethodError catch(final core::NoSuchMethodError e) {
diff --git a/pkg/front_end/testcases/argument_mismatch.dart.direct.expect b/pkg/front_end/testcases/argument_mismatch.dart.direct.expect
index 7331002..054897e 100644
--- a/pkg/front_end/testcases/argument_mismatch.dart.direct.expect
+++ b/pkg/front_end/testcases/argument_mismatch.dart.direct.expect
@@ -4,6 +4,6 @@
static method foo() → dynamic {}
static method test() → dynamic {
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#foo, 32, null, <dynamic>[null].toList(growable: false), <dynamic, dynamic>{}));
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#foo, 32, <dynamic>[].toList(growable: false), <dynamic>[null].toList(growable: false), <dynamic, dynamic>{}));
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/argument_mismatch.dart.strong.expect b/pkg/front_end/testcases/argument_mismatch.dart.strong.expect
index 7331002..054897e 100644
--- a/pkg/front_end/testcases/argument_mismatch.dart.strong.expect
+++ b/pkg/front_end/testcases/argument_mismatch.dart.strong.expect
@@ -4,6 +4,6 @@
static method foo() → dynamic {}
static method test() → dynamic {
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#foo, 32, null, <dynamic>[null].toList(growable: false), <dynamic, dynamic>{}));
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#foo, 32, <dynamic>[].toList(growable: false), <dynamic>[null].toList(growable: false), <dynamic, dynamic>{}));
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/expressions.dart.direct.expect b/pkg/front_end/testcases/expressions.dart.direct.expect
index 1fc8a29..7336aa1 100644
--- a/pkg/front_end/testcases/expressions.dart.direct.expect
+++ b/pkg/front_end/testcases/expressions.dart.direct.expect
@@ -69,7 +69,7 @@
core::print(core::int);
core::print(let final dynamic #t5 = core::int in let final dynamic #t6 = #t5.toString() in #t5);
try {
- core::print(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#toString, 32, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{})));
+ core::print(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#toString, 32, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{})));
throw "Shouldn't work";
}
on core::NoSuchMethodError catch(final core::NoSuchMethodError e) {
diff --git a/pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.direct.expect b/pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.direct.expect
index c78d5d1..942d268 100644
--- a/pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.direct.expect
+++ b/pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.direct.expect
@@ -16,8 +16,8 @@
;
}
static field dynamic a = new self::A::•();
-static field dynamic b = new self::B::•(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#x, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{})));
-static field dynamic c1 = <dynamic>[throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#x, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))];
+static field dynamic b = new self::B::•(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#x, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{})));
+static field dynamic c1 = <dynamic>[throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#x, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))];
static field dynamic c2 = const <dynamic>[];
static field dynamic d = <dynamic, dynamic>{"a": "b"};
static field dynamic e = let final dynamic #t1 = new self::A::•() in let final dynamic #t2 = #t1.x = 3 in #t1;
diff --git a/pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.expect b/pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.expect
index aaa9cb1..1e0a382 100644
--- a/pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/infer_from_complex_expressions_if_outer_most_value_is_precise.dart.strong.expect
@@ -16,8 +16,8 @@
;
}
static field self::A a = new self::A::•();
-static field self::B b = new self::B::•(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#x, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{})));
-static field core::List<dynamic> c1 = <dynamic>[throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#x, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))];
+static field self::B b = new self::B::•(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#x, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{})));
+static field core::List<dynamic> c1 = <dynamic>[throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#x, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))];
static field core::List<dynamic> c2 = const <dynamic>[];
static field core::Map<dynamic, dynamic> d = <dynamic, dynamic>{"a": "b"};
static field self::A e = let final self::A #t1 = new self::A::•() in let final dynamic #t2 = #t1.{self::A::x} = 3 in #t1;
diff --git a/pkg/front_end/testcases/inference/infer_local_function_referenced_before_declaration.dart.direct.expect b/pkg/front_end/testcases/inference/infer_local_function_referenced_before_declaration.dart.direct.expect
index 73f307b..c8e3f87 100644
--- a/pkg/front_end/testcases/inference/infer_local_function_referenced_before_declaration.dart.direct.expect
+++ b/pkg/front_end/testcases/inference/infer_local_function_referenced_before_declaration.dart.direct.expect
@@ -5,7 +5,7 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/infer_local_function_referenced_before_declaration.dart:9:74: Error: Previous use of 'g'.\n /*@returnType=dynamic*/ f() => /*error:REFERENCED_BEFORE_DECLARATION*/ g();\n ^"]/* from null */;
static method test() → dynamic {
function f() → dynamic
- return throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#g, 32, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}));
+ return throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#g, 32, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}));
const core::_ConstantExpressionError::•()._throw(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/infer_local_function_referenced_before_declaration.dart:14:3: Error: Can't declare 'g' because it was already used in this scope.\n g() => 0;\n ^"));
dynamic v = f;
}
diff --git a/pkg/front_end/testcases/inference/infer_local_function_referenced_before_declaration.dart.strong.expect b/pkg/front_end/testcases/inference/infer_local_function_referenced_before_declaration.dart.strong.expect
index f6f5da9..4281a82 100644
--- a/pkg/front_end/testcases/inference/infer_local_function_referenced_before_declaration.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/infer_local_function_referenced_before_declaration.dart.strong.expect
@@ -5,7 +5,7 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/infer_local_function_referenced_before_declaration.dart:9:74: Error: Previous use of 'g'.\n /*@returnType=dynamic*/ f() => /*error:REFERENCED_BEFORE_DECLARATION*/ g();\n ^"]/* from null */;
static method test() → dynamic {
function f() → dynamic
- return throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#g, 32, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}));
+ return throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#g, 32, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}));
const core::_ConstantExpressionError::•()._throw(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/infer_local_function_referenced_before_declaration.dart:14:3: Error: Can't declare 'g' because it was already used in this scope.\n g() => 0;\n ^"));
() → dynamic v = f;
}
diff --git a/pkg/front_end/testcases/rasta/static.dart.direct.expect b/pkg/front_end/testcases/rasta/static.dart.direct.expect
index a37998d..3690612 100644
--- a/pkg/front_end/testcases/rasta/static.dart.direct.expect
+++ b/pkg/front_end/testcases/rasta/static.dart.direct.expect
@@ -27,28 +27,28 @@
self::use(self::Foo::staticFunction);
self::Foo::staticGetter;
self::use(self::Foo::staticGetter);
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}));
- self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{})));
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, null, <dynamic>[self::Foo::staticConstant.+(1)].toList(growable: false), <dynamic, dynamic>{}));
- self::use(let final dynamic #t1 = self::Foo::staticConstant in let final dynamic #t2 = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, null, <dynamic>[#t1.+(1)].toList(growable: false), <dynamic, dynamic>{})) in #t1);
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}));
+ self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{})));
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, <dynamic>[].toList(growable: false), <dynamic>[self::Foo::staticConstant.+(1)].toList(growable: false), <dynamic, dynamic>{}));
+ self::use(let final dynamic #t1 = self::Foo::staticConstant in let final dynamic #t2 = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, <dynamic>[].toList(growable: false), <dynamic>[#t1.+(1)].toList(growable: false), <dynamic, dynamic>{})) in #t1);
self::Foo::staticField = self::Foo::staticField.+(1);
self::use(let final dynamic #t3 = self::Foo::staticField in let final dynamic #t4 = self::Foo::staticField = #t3.+(1) in #t3);
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, null, <dynamic>[self::Foo::staticFunction.+(1)].toList(growable: false), <dynamic, dynamic>{}));
- self::use(let final dynamic #t5 = self::Foo::staticFunction in let final dynamic #t6 = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, null, <dynamic>[#t5.+(1)].toList(growable: false), <dynamic, dynamic>{})) in #t5);
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, null, <dynamic>[self::Foo::staticGetter.+(1)].toList(growable: false), <dynamic, dynamic>{}));
- self::use(let final dynamic #t7 = self::Foo::staticGetter in let final dynamic #t8 = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, null, <dynamic>[#t7.+(1)].toList(growable: false), <dynamic, dynamic>{})) in #t7);
- self::Foo::staticSetter = (throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))).+(1);
- self::use(let final dynamic #t9 = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{})) in let final dynamic #t10 = self::Foo::staticSetter = #t9.+(1) in #t9);
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, null, <dynamic>[self::Foo::staticConstant.+(1)].toList(growable: false), <dynamic, dynamic>{}));
- self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, null, <dynamic>[self::Foo::staticConstant.+(1)].toList(growable: false), <dynamic, dynamic>{})));
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, <dynamic>[].toList(growable: false), <dynamic>[self::Foo::staticFunction.+(1)].toList(growable: false), <dynamic, dynamic>{}));
+ self::use(let final dynamic #t5 = self::Foo::staticFunction in let final dynamic #t6 = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, <dynamic>[].toList(growable: false), <dynamic>[#t5.+(1)].toList(growable: false), <dynamic, dynamic>{})) in #t5);
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, <dynamic>[].toList(growable: false), <dynamic>[self::Foo::staticGetter.+(1)].toList(growable: false), <dynamic, dynamic>{}));
+ self::use(let final dynamic #t7 = self::Foo::staticGetter in let final dynamic #t8 = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, <dynamic>[].toList(growable: false), <dynamic>[#t7.+(1)].toList(growable: false), <dynamic, dynamic>{})) in #t7);
+ self::Foo::staticSetter = (throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))).+(1);
+ self::use(let final dynamic #t9 = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{})) in let final dynamic #t10 = self::Foo::staticSetter = #t9.+(1) in #t9);
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, <dynamic>[].toList(growable: false), <dynamic>[self::Foo::staticConstant.+(1)].toList(growable: false), <dynamic, dynamic>{}));
+ self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, <dynamic>[].toList(growable: false), <dynamic>[self::Foo::staticConstant.+(1)].toList(growable: false), <dynamic, dynamic>{})));
self::Foo::staticField = self::Foo::staticField.+(1);
self::use(self::Foo::staticField = self::Foo::staticField.+(1));
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, null, <dynamic>[self::Foo::staticFunction.+(1)].toList(growable: false), <dynamic, dynamic>{}));
- self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, null, <dynamic>[self::Foo::staticFunction.+(1)].toList(growable: false), <dynamic, dynamic>{})));
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, null, <dynamic>[self::Foo::staticGetter.+(1)].toList(growable: false), <dynamic, dynamic>{}));
- self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, null, <dynamic>[self::Foo::staticGetter.+(1)].toList(growable: false), <dynamic, dynamic>{})));
- self::Foo::staticSetter = (throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))).+(1);
- self::use(self::Foo::staticSetter = (throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))).+(1));
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, <dynamic>[].toList(growable: false), <dynamic>[self::Foo::staticFunction.+(1)].toList(growable: false), <dynamic, dynamic>{}));
+ self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, <dynamic>[].toList(growable: false), <dynamic>[self::Foo::staticFunction.+(1)].toList(growable: false), <dynamic, dynamic>{})));
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, <dynamic>[].toList(growable: false), <dynamic>[self::Foo::staticGetter.+(1)].toList(growable: false), <dynamic, dynamic>{}));
+ self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, <dynamic>[].toList(growable: false), <dynamic>[self::Foo::staticGetter.+(1)].toList(growable: false), <dynamic, dynamic>{})));
+ self::Foo::staticSetter = (throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))).+(1);
+ self::use(self::Foo::staticSetter = (throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))).+(1));
self::Foo::staticConstant.call();
self::use(self::Foo::staticConstant.call());
self::Foo::staticField.call();
@@ -57,28 +57,28 @@
self::use(self::Foo::staticFunction());
self::Foo::staticGetter.call();
self::use(self::Foo::staticGetter.call());
- (throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))).call();
- self::use((throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))).call());
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, null, <dynamic>[87].toList(growable: false), <dynamic, dynamic>{}));
- self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, null, <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})));
+ (throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))).call();
+ self::use((throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))).call());
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, <dynamic>[].toList(growable: false), <dynamic>[87].toList(growable: false), <dynamic, dynamic>{}));
+ self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, <dynamic>[].toList(growable: false), <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})));
self::Foo::staticField = 87;
self::use(self::Foo::staticField = 87);
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, null, <dynamic>[87].toList(growable: false), <dynamic, dynamic>{}));
- self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, null, <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})));
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, null, <dynamic>[87].toList(growable: false), <dynamic, dynamic>{}));
- self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, null, <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})));
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, <dynamic>[].toList(growable: false), <dynamic>[87].toList(growable: false), <dynamic, dynamic>{}));
+ self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, <dynamic>[].toList(growable: false), <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})));
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, <dynamic>[].toList(growable: false), <dynamic>[87].toList(growable: false), <dynamic, dynamic>{}));
+ self::use(throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, <dynamic>[].toList(growable: false), <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})));
self::Foo::staticSetter = 87;
self::use(self::Foo::staticSetter = 87);
- self::Foo::staticConstant.==(null) ? throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, null, <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})) : null;
- self::use(let final dynamic #t11 = self::Foo::staticConstant in #t11.==(null) ? throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, null, <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})) : #t11);
+ self::Foo::staticConstant.==(null) ? throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, <dynamic>[].toList(growable: false), <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})) : null;
+ self::use(let final dynamic #t11 = self::Foo::staticConstant in #t11.==(null) ? throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticConstant, 34, <dynamic>[].toList(growable: false), <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})) : #t11);
self::Foo::staticField.==(null) ? self::Foo::staticField = 87 : null;
self::use(let final dynamic #t12 = self::Foo::staticField in #t12.==(null) ? self::Foo::staticField = 87 : #t12);
- self::Foo::staticFunction.==(null) ? throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, null, <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})) : null;
- self::use(let final dynamic #t13 = self::Foo::staticFunction in #t13.==(null) ? throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, null, <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})) : #t13);
- self::Foo::staticGetter.==(null) ? throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, null, <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})) : null;
- self::use(let final dynamic #t14 = self::Foo::staticGetter in #t14.==(null) ? throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, null, <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})) : #t14);
- (throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))).==(null) ? self::Foo::staticSetter = 87 : null;
- self::use(let final dynamic #t15 = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{})) in #t15.==(null) ? self::Foo::staticSetter = 87 : #t15);
+ self::Foo::staticFunction.==(null) ? throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, <dynamic>[].toList(growable: false), <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})) : null;
+ self::use(let final dynamic #t13 = self::Foo::staticFunction in #t13.==(null) ? throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticFunction, 34, <dynamic>[].toList(growable: false), <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})) : #t13);
+ self::Foo::staticGetter.==(null) ? throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, <dynamic>[].toList(growable: false), <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})) : null;
+ self::use(let final dynamic #t14 = self::Foo::staticGetter in #t14.==(null) ? throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticGetter, 34, <dynamic>[].toList(growable: false), <dynamic>[87].toList(growable: false), <dynamic, dynamic>{})) : #t14);
+ (throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}))).==(null) ? self::Foo::staticSetter = 87 : null;
+ self::use(let final dynamic #t15 = throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#staticSetter, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{})) in #t15.==(null) ? self::Foo::staticSetter = 87 : #t15);
}
on core::NoSuchMethodError catch(no-exception-var) {
}
diff --git a/pkg/front_end/testcases/regress/issue_29985.dart.direct.expect b/pkg/front_end/testcases/regress/issue_29985.dart.direct.expect
index b9cb7e4..2340577 100644
--- a/pkg/front_end/testcases/regress/issue_29985.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_29985.dart.direct.expect
@@ -4,6 +4,6 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_29985.dart:6:3: Error: The non-ASCII character '\u55357\u56603' (U+1F51B) can't be used in identifiers, only in strings and comments.\nTry using an US-ASCII letter, a digit, '_' (an underscore), or '\$' (a dollar sign).\n \u55357\u56603\n ^", "pkg/front_end/testcases/regress/issue_29985.dart:7:1: Error: Expected ';' before this.\n}\n^"]/* from null */;
static method bad() → dynamic {
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#π, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}));
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#π, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}));
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/regress/issue_29985.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29985.dart.strong.expect
index b9cb7e4..2340577 100644
--- a/pkg/front_end/testcases/regress/issue_29985.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29985.dart.strong.expect
@@ -4,6 +4,6 @@
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/regress/issue_29985.dart:6:3: Error: The non-ASCII character '\u55357\u56603' (U+1F51B) can't be used in identifiers, only in strings and comments.\nTry using an US-ASCII letter, a digit, '_' (an underscore), or '\$' (a dollar sign).\n \u55357\u56603\n ^", "pkg/front_end/testcases/regress/issue_29985.dart:7:1: Error: Expected ';' before this.\n}\n^"]/* from null */;
static method bad() → dynamic {
- throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#π, 33, null, <dynamic>[].toList(growable: false), <dynamic, dynamic>{}));
+ throw new core::NoSuchMethodError::withInvocation(null, new core::_InvocationMirror::_withType(#π, 33, <dynamic>[].toList(growable: false), <dynamic>[].toList(growable: false), <dynamic, dynamic>{}));
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/shaker/empty_program.dart.outline.expect b/pkg/front_end/testcases/shaker/empty_program.dart.outline.expect
index aefb13c..f43d6d8 100644
--- a/pkg/front_end/testcases/shaker/empty_program.dart.outline.expect
+++ b/pkg/front_end/testcases/shaker/empty_program.dart.outline.expect
@@ -202,7 +202,7 @@
method moveNext() → self::bool;
}
class _InvocationMirror extends self::Object implements self::Invocation {
- constructor •(self::String _functionName, self::List<dynamic> _argumentsDescriptor, self::List<dynamic> _arguments, self::bool _isSuperInvocation) → void;
+ constructor _withoutType(self::String _functionName, self::List<self::Type> _typeArguments, self::List<dynamic> _positionalArguments, self::Map<self::Symbol, dynamic> _namedArguments, self::bool _isSuperInvocation) → void;
get memberName() → self::Symbol;
get typeArguments() → self::List<self::Type>;
get positionalArguments() → self::List<dynamic>;
diff --git a/pkg/front_end/testcases/shaker/empty_program.dart.shaker.expect b/pkg/front_end/testcases/shaker/empty_program.dart.shaker.expect
index a027548..9b789df 100644
--- a/pkg/front_end/testcases/shaker/empty_program.dart.shaker.expect
+++ b/pkg/front_end/testcases/shaker/empty_program.dart.shaker.expect
@@ -156,7 +156,7 @@
- current
- moveNext
- class _InvocationMirror
- - (default constructor)
+ - dart.core::_withoutType
- memberName
- typeArguments
- positionalArguments
diff --git a/pkg/kernel/lib/core_types.dart b/pkg/kernel/lib/core_types.dart
index ab24202..8be8420 100644
--- a/pkg/kernel/lib/core_types.dart
+++ b/pkg/kernel/lib/core_types.dart
@@ -57,8 +57,8 @@
Class _invocationClass;
Constructor _externalNameDefaultConstructor;
Class _invocationMirrorClass;
- Constructor _invocationMirrorDefaultConstructor;
Constructor _invocationMirrorWithTypeConstructor;
+ Constructor _invocationMirrorWithoutTypeConstructor;
Class _noSuchMethodErrorClass;
Constructor _noSuchMethodErrorDefaultConstructor;
Procedure _listFromConstructor;
@@ -229,16 +229,16 @@
_index.getClass('dart:core', '_InvocationMirror');
}
- Constructor get invocationMirrorDefaultConstructor {
- return _invocationMirrorDefaultConstructor ??=
- _index.getMember('dart:core', '_InvocationMirror', '');
- }
-
Constructor get invocationMirrorWithTypeConstructor {
return _invocationMirrorWithTypeConstructor ??=
_index.getMember('dart:core', '_InvocationMirror', '_withType');
}
+ Constructor get invocationMirrorWithoutTypeConstructor {
+ return _invocationMirrorWithoutTypeConstructor ??=
+ _index.getMember('dart:core', '_InvocationMirror', '_withoutType');
+ }
+
Class get iterableClass {
return _iterableClass ??= _index.getClass('dart:core', 'Iterable');
}
diff --git a/pkg/kernel/lib/target/vm.dart b/pkg/kernel/lib/target/vm.dart
index c5f3f2d..98492f9 100644
--- a/pkg/kernel/lib/target/vm.dart
+++ b/pkg/kernel/lib/target/vm.dart
@@ -85,48 +85,30 @@
String name, Arguments arguments, int offset, bool isSuper) {
// See [_InvocationMirror]
// (../../../../runtime/lib/invocation_mirror_patch.dart).
- // The _InvocationMirror constructor takes the following arguments:
+ // The _InvocationMirror._withoutType constructor takes the following arguments:
// * Method name (a string).
- // * An arguments descriptor - a list consisting of:
- // - length of passed type argument vector, 0 if none passed.
- // - number of arguments (including receiver).
- // - number of positional arguments (including receiver).
- // - pairs (2 entries in the list) of
- // * named arguments name.
- // * index of named argument in arguments list.
- // * A list of arguments, where the first ones are the positional arguments.
+ // * List of type arguments.
+ // * List of positional arguments.
+ // * List of named arguments.
// * Whether it's a super invocation or not.
-
- int typeArgsLen = 0; // TODO(regis): Type arguments of generic function.
- int numPositionalArguments = arguments.positional.length;
- numPositionalArguments++; // Include the receiver.
- int numArguments = numPositionalArguments + arguments.named.length;
- List<Expression> argumentsDescriptor = [
- new IntLiteral(typeArgsLen)..fileOffset = offset,
- new IntLiteral(numArguments)..fileOffset = offset,
- new IntLiteral(numPositionalArguments)..fileOffset = offset,
- ];
-
- List<Expression> argumentsList = <Expression>[receiver];
- argumentsList.addAll(arguments.positional);
-
- for (NamedExpression argument in arguments.named) {
- argumentsDescriptor.add(
- new StringLiteral(argument.name)..fileOffset = argument.fileOffset);
- argumentsDescriptor.add(new IntLiteral(argumentsList.length)
- ..fileOffset = argument.fileOffset);
- argumentsList.add(argument.value);
- }
-
- Arguments constructorArguments = new Arguments([
- new StringLiteral(name)..fileOffset = offset,
- _fixedLengthList(argumentsDescriptor, arguments.fileOffset),
- _fixedLengthList(argumentsList, arguments.fileOffset),
- new BoolLiteral(isSuper)..fileOffset = arguments.fileOffset,
- ]);
-
return new ConstructorInvocation(
- coreTypes.invocationMirrorDefaultConstructor, constructorArguments)
+ coreTypes.invocationMirrorWithoutTypeConstructor,
+ new Arguments(<Expression>[
+ new StringLiteral(name)..fileOffset = offset,
+ _fixedLengthList(
+ arguments.types.map((t) => new TypeLiteral(t)).toList(),
+ arguments.fileOffset),
+ _fixedLengthList(arguments.positional, arguments.fileOffset),
+ new MapLiteral(new List<MapEntry>.from(
+ arguments.named.map((NamedExpression arg) {
+ return new MapEntry(
+ new SymbolLiteral(arg.name)..fileOffset = arg.fileOffset,
+ arg.value)
+ ..fileOffset = arg.fileOffset;
+ })))
+ ..fileOffset = arguments.fileOffset,
+ new BoolLiteral(isSuper)..fileOffset = arguments.fileOffset
+ ]))
..fileOffset = offset;
}
@@ -163,7 +145,9 @@
new Arguments(<Expression>[
new SymbolLiteral(name)..fileOffset = offset,
new IntLiteral(type)..fileOffset = offset,
- new NullLiteral(), // TODO(regis): Type arguments of generic function.
+ _fixedLengthList(
+ arguments.types.map((t) => new TypeLiteral(t)).toList(),
+ arguments.fileOffset),
_fixedLengthList(arguments.positional, arguments.fileOffset),
new MapLiteral(new List<MapEntry>.from(
arguments.named.map((NamedExpression arg) {
diff --git a/runtime/lib/invocation_mirror_patch.dart b/runtime/lib/invocation_mirror_patch.dart
index 26015e9..169d10e 100644
--- a/runtime/lib/invocation_mirror_patch.dart
+++ b/runtime/lib/invocation_mirror_patch.dart
@@ -164,6 +164,9 @@
_InvocationMirror(this._functionName, this._argumentsDescriptor,
this._arguments, this._isSuperInvocation);
+ _InvocationMirror._withoutType(this._functionName, this._typeArguments,
+ this._positionalArguments, this._namedArguments, this._isSuperInvocation);
+
static _allocateInvocationMirror(String functionName,
List argumentsDescriptor, List arguments, bool isSuperInvocation) {
return new _InvocationMirror(
diff --git a/tests/language_2/generic_no_such_method_dispatcher_simple_test.dart b/tests/language_2/generic_no_such_method_dispatcher_simple_test.dart
new file mode 100644
index 0000000..a829f56
--- /dev/null
+++ b/tests/language_2/generic_no_such_method_dispatcher_simple_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2017, 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.
+// VMOptions=--reify-generic-functions --optimization-counter-threshold=10 --no-use-osr --no-background-compilation
+
+library generic_no_such_method_dispatcher_test_simple;
+
+import "package:expect/expect.dart";
+
+// A simple test that noSuchMethod dispatching works correctly with generic
+// functions. We will remove this once the more complex version of this test
+// 'generic_no_such_method_dispatcher_test' can be compiled by Fasta.
+
+class A {}
+
+class B extends A {
+ foo() => super.foo<int>();
+}
+
+test(fn) {
+ try {
+ fn();
+ } catch (e) {
+ Expect.isTrue(e.toString().contains("foo<int>"));
+ }
+}
+
+main() {
+ test(() => (new B()).foo()); // missing generic super call
+ test(() => foo<int>()); // missing generic static call
+ test(() => (new A()).foo<int>()); // missing generic method call
+}
diff --git a/tests/language_2/language_2_analyzer.status b/tests/language_2/language_2_analyzer.status
index 97941fe..889f007 100644
--- a/tests/language_2/language_2_analyzer.status
+++ b/tests/language_2/language_2_analyzer.status
@@ -464,6 +464,9 @@
mixin_invalid_bound_test/09: MissingCompileTimeError
mixin_invalid_bound_test/10: MissingCompileTimeError
+[ $compiler == dart2analyzer ]
+generic_no_such_method_dispatcher_simple_test: Skip # This test is just for kernel.
+
[ $compiler == dart2analyzer && ! $strong && $checked ]
abstract_beats_arguments_test: MissingCompileTimeError
abstract_exact_selector_test/01: MissingCompileTimeError
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index 9d25866..475e16f 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -232,6 +232,7 @@
generic_methods_type_expression_test: RuntimeError
generic_methods_unused_parameter_test: RuntimeError
generic_no_such_method_dispatcher_test: CompileTimeError
+generic_no_such_method_dispatcher_simple_test: Skip # This test is just for kernel.
generic_tearoff_test: CompileTimeError
getter_no_setter2_test/00: MissingCompileTimeError
getter_no_setter2_test/01: MissingCompileTimeError
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index a6fc834..6635bf1 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -52,6 +52,7 @@
generic_methods_test: CompileTimeError
generic_methods_type_expression_test: CompileTimeError
generic_no_such_method_dispatcher_test: CompileTimeError
+generic_no_such_method_dispatcher_simple_test: Skip # This test is just for kernel.
generic_tearoff_test: CompileTimeError
generic_test: CompileTimeError
generics_test: CompileTimeError
diff --git a/tests/language_2/language_2_vm.status b/tests/language_2/language_2_vm.status
index 0500e86..5c1fbe0 100644
--- a/tests/language_2/language_2_vm.status
+++ b/tests/language_2/language_2_vm.status
@@ -1086,3 +1086,6 @@
deferred_load_constants_test/03: Fail
deferred_load_constants_test/05: Fail
deferred_not_loaded_check_test: RuntimeError
+
+[ $runtime == vm && $compiler != dartk ]
+generic_no_such_method_dispatcher_simple_test: Skip # This test is only for kernel.