mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 01:30:32 +00:00
[kernel] Update FunctionNode.computeFunctionType for constructor tear offs
FunctionNode.computeFunctionType didn't handle constructors for generic classes and would fail to substitute type parameters from the enclosing class. Change-Id: Ia16ea55ce774597590e6e7da7af066b5c66dfe67 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/207123 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
This commit is contained in:
parent
8e1fbc9ab3
commit
4ca415a9fa
|
@ -4,14 +4,14 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:32: Error: A value of type 'A<X/*1*/> Function<X>(X/*1*/, int)' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'unknown'.
|
||||
// - 'X/*2*/' is from 'unknown'.
|
||||
// A<X> Function<X>(X) test2() => A.foo2; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:32: Error: A value of type 'A<X/*1*/> Function<X>()' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'unknown'.
|
||||
// - 'X/*2*/' is from 'unknown'.
|
||||
// A<X> Function<X>(X) test3() => A.new; // Error.
|
||||
// ^
|
||||
|
@ -72,14 +72,14 @@ static method test1() → <X extends core::Object? = dynamic>(X%) → self::A<X%
|
|||
static method test2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
|
||||
return let final Never #t1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:32: Error: A value of type 'A<X/*1*/> Function<X>(X/*1*/, int)' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
- 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'unknown'.
|
||||
- 'X/*2*/' is from 'unknown'.
|
||||
A<X> Function<X>(X) test2() => A.foo2; // Error.
|
||||
^" in self::A::foo2 as{TypeError,ForNonNullableByDefault} Never;
|
||||
static method test3() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
|
||||
return let final Never #t2 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:32: Error: A value of type 'A<X/*1*/> Function<X>()' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
- 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'unknown'.
|
||||
- 'X/*2*/' is from 'unknown'.
|
||||
A<X> Function<X>(X) test3() => A.new; // Error.
|
||||
^" in self::A::• as{TypeError,ForNonNullableByDefault} Never;
|
||||
|
|
|
@ -4,14 +4,14 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:32: Error: A value of type 'A<X/*1*/> Function<X>(X/*1*/, int)' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'unknown'.
|
||||
// - 'X/*2*/' is from 'unknown'.
|
||||
// A<X> Function<X>(X) test2() => A.foo2; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:32: Error: A value of type 'A<X/*1*/> Function<X>()' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'unknown'.
|
||||
// - 'X/*2*/' is from 'unknown'.
|
||||
// A<X> Function<X>(X) test3() => A.new; // Error.
|
||||
// ^
|
||||
|
@ -72,14 +72,14 @@ static method test1() → <X extends core::Object? = dynamic>(X%) → self::A<X%
|
|||
static method test2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
|
||||
return let final Never #t1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:32: Error: A value of type 'A<X/*1*/> Function<X>(X/*1*/, int)' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
- 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'unknown'.
|
||||
- 'X/*2*/' is from 'unknown'.
|
||||
A<X> Function<X>(X) test2() => A.foo2; // Error.
|
||||
^" in self::A::foo2 as{TypeError,ForNonNullableByDefault} Never;
|
||||
static method test3() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
|
||||
return let final Never #t2 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:32: Error: A value of type 'A<X/*1*/> Function<X>()' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
- 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'unknown'.
|
||||
- 'X/*2*/' is from 'unknown'.
|
||||
A<X> Function<X>(X) test3() => A.new; // Error.
|
||||
^" in self::A::• as{TypeError,ForNonNullableByDefault} Never;
|
||||
|
|
|
@ -4,14 +4,14 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:32: Error: A value of type 'A<X/*1*/> Function<X>(X/*1*/, int)' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'unknown'.
|
||||
// - 'X/*2*/' is from 'unknown'.
|
||||
// A<X> Function<X>(X) test2() => A.foo2; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:32: Error: A value of type 'A<X/*1*/> Function<X>()' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'unknown'.
|
||||
// - 'X/*2*/' is from 'unknown'.
|
||||
// A<X> Function<X>(X) test3() => A.new; // Error.
|
||||
// ^
|
||||
|
@ -72,14 +72,14 @@ static method test1() → <X extends core::Object? = dynamic>(X%) → self::A<X%
|
|||
static method test2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
|
||||
return let final Never #t1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:32: Error: A value of type 'A<X/*1*/> Function<X>(X/*1*/, int)' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
- 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'unknown'.
|
||||
- 'X/*2*/' is from 'unknown'.
|
||||
A<X> Function<X>(X) test2() => A.foo2; // Error.
|
||||
^" in self::A::foo2 as{TypeError,ForNonNullableByDefault} Never;
|
||||
static method test3() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
|
||||
return let final Never #t2 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:32: Error: A value of type 'A<X/*1*/> Function<X>()' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
- 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'unknown'.
|
||||
- 'X/*2*/' is from 'unknown'.
|
||||
A<X> Function<X>(X) test3() => A.new; // Error.
|
||||
^" in self::A::• as{TypeError,ForNonNullableByDefault} Never;
|
||||
|
|
|
@ -4,14 +4,14 @@ library /*isNonNullableByDefault*/;
|
|||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:32: Error: A value of type 'A<X/*1*/> Function<X>(X/*1*/, int)' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'unknown'.
|
||||
// - 'X/*2*/' is from 'unknown'.
|
||||
// A<X> Function<X>(X) test2() => A.foo2; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:32: Error: A value of type 'A<X/*1*/> Function<X>()' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
// - 'X/*1*/' is from 'unknown'.
|
||||
// - 'X/*2*/' is from 'unknown'.
|
||||
// A<X> Function<X>(X) test3() => A.new; // Error.
|
||||
// ^
|
||||
|
@ -72,14 +72,14 @@ static method test1() → <X extends core::Object? = dynamic>(X%) → self::A<X%
|
|||
static method test2() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
|
||||
return let final Never #t1 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:13:32: Error: A value of type 'A<X/*1*/> Function<X>(X/*1*/, int)' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
- 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'unknown'.
|
||||
- 'X/*2*/' is from 'unknown'.
|
||||
A<X> Function<X>(X) test2() => A.foo2; // Error.
|
||||
^" in self::A::foo2 as{TypeError,ForNonNullableByDefault} Never;
|
||||
static method test3() → <X extends core::Object? = dynamic>(X%) → self::A<X%>
|
||||
return let final Never #t2 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart:14:32: Error: A value of type 'A<X/*1*/> Function<X>()' can't be returned from a function with return type 'A<X/*2*/> Function<X>(X/*2*/)'.
|
||||
- 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_with_context.dart'.
|
||||
- 'X/*1*/' is from 'unknown'.
|
||||
- 'X/*2*/' is from 'unknown'.
|
||||
A<X> Function<X>(X) test3() => A.new; // Error.
|
||||
^" in self::A::• as{TypeError,ForNonNullableByDefault} Never;
|
||||
|
|
|
@ -19,4 +19,17 @@ testFooExtraArgs() => A<int, String>.foo; // Error.
|
|||
testNewExtraArgs() => A<int, String>.new; // Error.
|
||||
testBarExtraArgs() => A<int, String>.bar; // Error.
|
||||
|
||||
method() {
|
||||
var foo = A.foo; // Ok.
|
||||
var fooArgs = A<int>.foo; // Ok.
|
||||
var _new = A.new; // Ok.
|
||||
var newArgs = A<int>.new; // Ok.
|
||||
var bar = A.bar; // Ok.
|
||||
var barArgs = A<int>.bar; // Ok.
|
||||
|
||||
var fooExtraArgs = A<int, String>.foo; // Error.
|
||||
var newExtraArgs = A<int, String>.new; // Error.
|
||||
var barExtraArgs = A<int, String>.bar; // Error.
|
||||
}
|
||||
|
||||
main() {}
|
||||
|
|
|
@ -17,6 +17,21 @@ library /*isNonNullableByDefault*/;
|
|||
// testBarExtraArgs() => A<int, String>.bar; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:30:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
// Try removing the extra type arguments.
|
||||
// var fooExtraArgs = A<int, String>.foo; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:31:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
// Try removing the extra type arguments.
|
||||
// var newExtraArgs = A<int, String>.new; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:32:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
// Try removing the extra type arguments.
|
||||
// var barExtraArgs = A<int, String>.bar; // Error.
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
@ -55,4 +70,24 @@ static method testBarExtraArgs() → dynamic
|
|||
Try removing the extra type arguments.
|
||||
testBarExtraArgs() => A<int, String>.bar; // Error.
|
||||
^";
|
||||
static method method() → dynamic {
|
||||
<X extends core::Object? = dynamic>() → self::A<X%> foo = self::A::foo;
|
||||
() → self::A<core::int> fooArgs = self::A::foo<core::int>;
|
||||
<X extends core::Object? = dynamic>() → self::A<X%> _new = self::A::•;
|
||||
() → self::A<core::int> newArgs = self::A::•<core::int>;
|
||||
<X extends core::Object? = dynamic>() → self::A<X%> bar = self::A::bar;
|
||||
() → self::A<core::int> barArgs = self::A::bar<core::int>;
|
||||
invalid-type fooExtraArgs = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:30:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
Try removing the extra type arguments.
|
||||
var fooExtraArgs = A<int, String>.foo; // Error.
|
||||
^";
|
||||
invalid-type newExtraArgs = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:31:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
Try removing the extra type arguments.
|
||||
var newExtraArgs = A<int, String>.new; // Error.
|
||||
^";
|
||||
invalid-type barExtraArgs = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:32:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
Try removing the extra type arguments.
|
||||
var barExtraArgs = A<int, String>.bar; // Error.
|
||||
^";
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
|
|
@ -17,6 +17,21 @@ library /*isNonNullableByDefault*/;
|
|||
// testBarExtraArgs() => A<int, String>.bar; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:30:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
// Try removing the extra type arguments.
|
||||
// var fooExtraArgs = A<int, String>.foo; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:31:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
// Try removing the extra type arguments.
|
||||
// var newExtraArgs = A<int, String>.new; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:32:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
// Try removing the extra type arguments.
|
||||
// var barExtraArgs = A<int, String>.bar; // Error.
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
@ -55,4 +70,24 @@ static method testBarExtraArgs() → dynamic
|
|||
Try removing the extra type arguments.
|
||||
testBarExtraArgs() => A<int, String>.bar; // Error.
|
||||
^";
|
||||
static method method() → dynamic {
|
||||
<X extends core::Object? = dynamic>() → self::A<X%> foo = self::A::foo;
|
||||
() → self::A<core::int> fooArgs = self::A::foo<core::int>;
|
||||
<X extends core::Object? = dynamic>() → self::A<X%> _new = self::A::•;
|
||||
() → self::A<core::int> newArgs = self::A::•<core::int>;
|
||||
<X extends core::Object? = dynamic>() → self::A<X%> bar = self::A::bar;
|
||||
() → self::A<core::int> barArgs = self::A::bar<core::int>;
|
||||
invalid-type fooExtraArgs = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:30:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
Try removing the extra type arguments.
|
||||
var fooExtraArgs = A<int, String>.foo; // Error.
|
||||
^";
|
||||
invalid-type newExtraArgs = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:31:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
Try removing the extra type arguments.
|
||||
var newExtraArgs = A<int, String>.new; // Error.
|
||||
^";
|
||||
invalid-type barExtraArgs = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:32:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
Try removing the extra type arguments.
|
||||
var barExtraArgs = A<int, String>.bar; // Error.
|
||||
^";
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
|
|
@ -12,4 +12,5 @@ testBarArgs() => A<int>.bar;
|
|||
testFooExtraArgs() => A<int, String>.foo;
|
||||
testNewExtraArgs() => A<int, String>.new;
|
||||
testBarExtraArgs() => A<int, String>.bar;
|
||||
method() {}
|
||||
main() {}
|
||||
|
|
|
@ -17,6 +17,21 @@ library /*isNonNullableByDefault*/;
|
|||
// testBarExtraArgs() => A<int, String>.bar; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:30:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
// Try removing the extra type arguments.
|
||||
// var fooExtraArgs = A<int, String>.foo; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:31:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
// Try removing the extra type arguments.
|
||||
// var newExtraArgs = A<int, String>.new; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:32:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
// Try removing the extra type arguments.
|
||||
// var barExtraArgs = A<int, String>.bar; // Error.
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
@ -55,4 +70,24 @@ static method testBarExtraArgs() → dynamic
|
|||
Try removing the extra type arguments.
|
||||
testBarExtraArgs() => A<int, String>.bar; // Error.
|
||||
^";
|
||||
static method method() → dynamic {
|
||||
<X extends core::Object? = dynamic>() → self::A<X%> foo = self::A::foo;
|
||||
() → self::A<core::int> fooArgs = self::A::foo<core::int>;
|
||||
<X extends core::Object? = dynamic>() → self::A<X%> _new = self::A::•;
|
||||
() → self::A<core::int> newArgs = self::A::•<core::int>;
|
||||
<X extends core::Object? = dynamic>() → self::A<X%> bar = self::A::bar;
|
||||
() → self::A<core::int> barArgs = self::A::bar<core::int>;
|
||||
invalid-type fooExtraArgs = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:30:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
Try removing the extra type arguments.
|
||||
var fooExtraArgs = A<int, String>.foo; // Error.
|
||||
^";
|
||||
invalid-type newExtraArgs = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:31:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
Try removing the extra type arguments.
|
||||
var newExtraArgs = A<int, String>.new; // Error.
|
||||
^";
|
||||
invalid-type barExtraArgs = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:32:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
Try removing the extra type arguments.
|
||||
var barExtraArgs = A<int, String>.bar; // Error.
|
||||
^";
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
|
|
@ -28,5 +28,7 @@ static method testNewExtraArgs() → dynamic
|
|||
;
|
||||
static method testBarExtraArgs() → dynamic
|
||||
;
|
||||
static method method() → dynamic
|
||||
;
|
||||
static method main() → dynamic
|
||||
;
|
||||
|
|
|
@ -17,6 +17,21 @@ library /*isNonNullableByDefault*/;
|
|||
// testBarExtraArgs() => A<int, String>.bar; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:30:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
// Try removing the extra type arguments.
|
||||
// var fooExtraArgs = A<int, String>.foo; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:31:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
// Try removing the extra type arguments.
|
||||
// var newExtraArgs = A<int, String>.new; // Error.
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:32:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
// Try removing the extra type arguments.
|
||||
// var barExtraArgs = A<int, String>.bar; // Error.
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
|
@ -55,4 +70,24 @@ static method testBarExtraArgs() → dynamic
|
|||
Try removing the extra type arguments.
|
||||
testBarExtraArgs() => A<int, String>.bar; // Error.
|
||||
^";
|
||||
static method method() → dynamic {
|
||||
<X extends core::Object? = dynamic>() → self::A<X%> foo = self::A::foo;
|
||||
() → self::A<core::int> fooArgs = self::A::foo<core::int>;
|
||||
<X extends core::Object? = dynamic>() → self::A<X%> _new = self::A::•;
|
||||
() → self::A<core::int> newArgs = self::A::•<core::int>;
|
||||
<X extends core::Object? = dynamic>() → self::A<X%> bar = self::A::bar;
|
||||
() → self::A<core::int> barArgs = self::A::bar<core::int>;
|
||||
invalid-type fooExtraArgs = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:30:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
Try removing the extra type arguments.
|
||||
var fooExtraArgs = A<int, String>.foo; // Error.
|
||||
^";
|
||||
invalid-type newExtraArgs = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:31:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
Try removing the extra type arguments.
|
||||
var newExtraArgs = A<int, String>.new; // Error.
|
||||
^";
|
||||
invalid-type barExtraArgs = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/generic_tearoff_without_context.dart:32:22: Error: Too many type arguments: 1 allowed, but 2 found.
|
||||
Try removing the extra type arguments.
|
||||
var barExtraArgs = A<int, String>.bar; // Error.
|
||||
^";
|
||||
}
|
||||
static method main() → dynamic {}
|
||||
|
|
|
@ -7,18 +7,12 @@ library /*isNonNullableByDefault*/;
|
|||
// Try specifying type arguments explicitly so that they conform to the bounds.
|
||||
// A<dynamic> Function(String) test5() => A.foo; // Error.
|
||||
// ^
|
||||
// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class A<X extends num> {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:40: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A<X> Function<X extends num>(X)'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'.
|
||||
// Try specifying type arguments explicitly so that they conform to the bounds.
|
||||
// A<dynamic> Function(String) test6() => A.new; // Error.
|
||||
// ^
|
||||
// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class A<X extends num> {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:23:41: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A<X> Function<X extends num>(X)'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'.
|
||||
|
|
|
@ -7,18 +7,12 @@ library /*isNonNullableByDefault*/;
|
|||
// Try specifying type arguments explicitly so that they conform to the bounds.
|
||||
// A<dynamic> Function(String) test5() => A.foo; // Error.
|
||||
// ^
|
||||
// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class A<X extends num> {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:17:40: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A<X> Function<X extends num>(X)'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'.
|
||||
// Try specifying type arguments explicitly so that they conform to the bounds.
|
||||
// A<dynamic> Function(String) test6() => A.new; // Error.
|
||||
// ^
|
||||
// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:5:9: Context: This is the type variable whose bound isn't conformed to.
|
||||
// class A<X extends num> {
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/instantiation.dart:23:41: Error: Inferred type argument 'String' doesn't conform to the bound 'num' of the type variable 'X' on 'A<X> Function<X extends num>(X)'.
|
||||
// - 'A' is from 'pkg/front_end/testcases/constructor_tearoffs/instantiation.dart'.
|
||||
|
|
|
@ -3386,6 +3386,14 @@ class FunctionNode extends TreeNode {
|
|||
/// resulting function type is generic, a fresh set of type parameters is used
|
||||
/// in it.
|
||||
FunctionType computeFunctionType(Nullability nullability) {
|
||||
TreeNode? parent = this.parent;
|
||||
List<TypeParameter> typeParameters;
|
||||
if (parent is Constructor) {
|
||||
assert(this.typeParameters.isEmpty);
|
||||
typeParameters = parent.enclosingClass.typeParameters;
|
||||
} else {
|
||||
typeParameters = this.typeParameters;
|
||||
}
|
||||
return typeParameters.isEmpty
|
||||
? computeThisFunctionType(nullability)
|
||||
: getFreshTypeParameters(typeParameters)
|
||||
|
|
Loading…
Reference in a new issue