mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 10:33:28 +00:00
[cfe] Handle nullable function types in explicit instantiation
Part of https://github.com/dart-lang/sdk/issues/46232 Change-Id: I390dc15a253cf0b335ed41bf945bbab2a3b2bdcc Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215545 Reviewed-by: Chloe Stefantsova <dmitryas@google.com> Commit-Queue: Johnni Winther <johnniwinther@google.com>
This commit is contained in:
parent
cf1591f935
commit
74fd108a69
|
@ -2100,6 +2100,37 @@ Message _withArgumentsInstantiationNonGenericFunctionType(
|
||||||
arguments: {'type': _type});
|
arguments: {'type': _type});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
|
const Template<Message Function(DartType _type, bool isNonNullableByDefault)>
|
||||||
|
templateInstantiationNullableGenericFunctionType = const Template<
|
||||||
|
Message Function(DartType _type, bool isNonNullableByDefault)>(
|
||||||
|
problemMessageTemplate:
|
||||||
|
r"""The static type of the explicit instantiation operand must be a non-null generic function type but is '#type'.""",
|
||||||
|
correctionMessageTemplate:
|
||||||
|
r"""Try changing the operand or remove the type arguments.""",
|
||||||
|
withArguments: _withArgumentsInstantiationNullableGenericFunctionType);
|
||||||
|
|
||||||
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
|
const Code<Message Function(DartType _type, bool isNonNullableByDefault)>
|
||||||
|
codeInstantiationNullableGenericFunctionType =
|
||||||
|
const Code<Message Function(DartType _type, bool isNonNullableByDefault)>(
|
||||||
|
"InstantiationNullableGenericFunctionType",
|
||||||
|
analyzerCodes: <String>["DISALLOWED_TYPE_INSTANTIATION_EXPRESSION"]);
|
||||||
|
|
||||||
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
|
Message _withArgumentsInstantiationNullableGenericFunctionType(
|
||||||
|
DartType _type, bool isNonNullableByDefault) {
|
||||||
|
TypeLabeler labeler = new TypeLabeler(isNonNullableByDefault);
|
||||||
|
List<Object> typeParts = labeler.labelType(_type);
|
||||||
|
String type = typeParts.join();
|
||||||
|
return new Message(codeInstantiationNullableGenericFunctionType,
|
||||||
|
problemMessage:
|
||||||
|
"""The static type of the explicit instantiation operand must be a non-null generic function type but is '${type}'.""" +
|
||||||
|
labeler.originMessages,
|
||||||
|
correctionMessage: """Try changing the operand or remove the type arguments.""",
|
||||||
|
arguments: {'type': _type});
|
||||||
|
}
|
||||||
|
|
||||||
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
|
||||||
const Template<
|
const Template<
|
||||||
Message Function(
|
Message Function(
|
||||||
|
|
|
@ -412,12 +412,24 @@ class InferenceVisitor
|
||||||
DartType resultType = const InvalidType();
|
DartType resultType = const InvalidType();
|
||||||
if (operandType is FunctionType) {
|
if (operandType is FunctionType) {
|
||||||
if (operandType.typeParameters.length == node.typeArguments.length) {
|
if (operandType.typeParameters.length == node.typeArguments.length) {
|
||||||
inferrer.checkBoundsInInstantiation(
|
if (!inferrer.isTopLevel) {
|
||||||
operandType, node.typeArguments, node.fileOffset,
|
inferrer.checkBoundsInInstantiation(
|
||||||
inferred: false);
|
operandType, node.typeArguments, node.fileOffset,
|
||||||
resultType = Substitution.fromPairs(
|
inferred: false);
|
||||||
operandType.typeParameters, node.typeArguments)
|
}
|
||||||
.substituteType(operandType.withoutTypeParameters);
|
if (operandType.isPotentiallyNullable) {
|
||||||
|
if (!inferrer.isTopLevel) {
|
||||||
|
result = inferrer.helper!.buildProblem(
|
||||||
|
templateInstantiationNullableGenericFunctionType.withArguments(
|
||||||
|
operandType, inferrer.isNonNullableByDefault),
|
||||||
|
node.fileOffset,
|
||||||
|
noLength);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
resultType = Substitution.fromPairs(
|
||||||
|
operandType.typeParameters, node.typeArguments)
|
||||||
|
.substituteType(operandType.withoutTypeParameters);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (!inferrer.isTopLevel) {
|
if (!inferrer.isTopLevel) {
|
||||||
if (operandType.typeParameters.isEmpty) {
|
if (operandType.typeParameters.isEmpty) {
|
||||||
|
|
|
@ -5355,6 +5355,14 @@ InstantiationNonGenericFunctionType:
|
||||||
f() {}
|
f() {}
|
||||||
main() => f<int>;
|
main() => f<int>;
|
||||||
|
|
||||||
|
InstantiationNullableGenericFunctionType:
|
||||||
|
problemMessage: "The static type of the explicit instantiation operand must be a non-null generic function type but is '#type'."
|
||||||
|
correctionMessage: "Try changing the operand or remove the type arguments."
|
||||||
|
analyzerCode: DISALLOWED_TYPE_INSTANTIATION_EXPRESSION
|
||||||
|
experiments: constructor-tearoffs
|
||||||
|
script: |
|
||||||
|
test(void Function<T>()? f) => f<int>;
|
||||||
|
|
||||||
InstantiationTooFewArguments:
|
InstantiationTooFewArguments:
|
||||||
problemMessage: "Too few type arguments: #count required, #count2 given."
|
problemMessage: "Too few type arguments: #count required, #count2 given."
|
||||||
correctionMessage: "Try adding the missing type arguments."
|
correctionMessage: "Try adding the missing type arguments."
|
||||||
|
|
|
@ -42,6 +42,34 @@ test<T extends Class?, S extends int>(
|
||||||
f3<int>; // error
|
f3<int>; // error
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Class c1 = Class();
|
||||||
|
Class? c2;
|
||||||
|
GetterCall c3 = GetterCall();
|
||||||
|
int i1 = 0;
|
||||||
|
int? i2 = null;
|
||||||
|
void Function<T>()? f1 = null;
|
||||||
|
Never n = throw '';
|
||||||
|
dynamic d = null;
|
||||||
|
String a = '';
|
||||||
|
double b = 0.5;
|
||||||
|
bool c = true;
|
||||||
|
FutureOr<Class> f2 = Class();
|
||||||
|
Function f3 = () {};
|
||||||
|
|
||||||
|
var topLevel1 = c1<int>; // ok
|
||||||
|
var topLevel2 = i1<int>; // ok
|
||||||
|
var topLevel3 = c2<int>; // error
|
||||||
|
var topLevel4 = c3<int>; // error
|
||||||
|
var topLevel5 = i2<int>; // error
|
||||||
|
var topLevel6 = f1<int>; // error
|
||||||
|
var topLevel7 = n<int>; // error
|
||||||
|
var topLevel8 = d<int>; // error
|
||||||
|
var topLevel9 = a<int>; // error
|
||||||
|
var topLevel10 = b<int>; // error
|
||||||
|
var topLevel11 = c<int>; // error
|
||||||
|
var topLevel12 = f2<int>; // error
|
||||||
|
var topLevel13 = f3<int>; // error
|
||||||
|
|
||||||
class Class {
|
class Class {
|
||||||
call<T>() {}
|
call<T>() {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,11 @@ library /*isNonNullableByDefault*/;
|
||||||
// s<int>; // error
|
// s<int>; // error
|
||||||
// ^
|
// ^
|
||||||
//
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:35:5: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// f1<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
// Try changing the operand or remove the type arguments.
|
// Try changing the operand or remove the type arguments.
|
||||||
// n<int>; // error
|
// n<int>; // error
|
||||||
|
@ -71,6 +76,65 @@ library /*isNonNullableByDefault*/;
|
||||||
// f3<int>; // error
|
// f3<int>; // error
|
||||||
// ^
|
// ^
|
||||||
//
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:61:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Class?'.
|
||||||
|
// - 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel3 = c2<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:62:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'GetterCall'.
|
||||||
|
// - 'GetterCall' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel4 = c3<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:63:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int?'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel5 = i2<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:64:19: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel6 = f1<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:65:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel7 = n<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:66:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel8 = d<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:67:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel9 = a<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:68:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'double'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel10 = b<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:69:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'bool'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel11 = c<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:70:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'FutureOr<Class>'.
|
||||||
|
// - 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel12 = f2<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:71:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
|
||||||
|
// - 'Function' is from 'dart:core'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel13 = f3<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
import self as self;
|
import self as self;
|
||||||
import "dart:core" as core;
|
import "dart:core" as core;
|
||||||
|
|
||||||
|
@ -107,6 +171,69 @@ extension Ambiguous2 on core::String {
|
||||||
method call = self::Ambiguous2|call;
|
method call = self::Ambiguous2|call;
|
||||||
tearoff call = self::Ambiguous2|get#call;
|
tearoff call = self::Ambiguous2|get#call;
|
||||||
}
|
}
|
||||||
|
static field self::Class c1 = new self::Class::•();
|
||||||
|
static field self::Class? c2;
|
||||||
|
static field self::GetterCall c3 = new self::GetterCall::•();
|
||||||
|
static field core::int i1 = 0;
|
||||||
|
static field core::int? i2 = null;
|
||||||
|
static field <T extends core::Object? = dynamic>() →? void f1 = null;
|
||||||
|
static field Never n = throw "";
|
||||||
|
static field dynamic d = null;
|
||||||
|
static field core::String a = "";
|
||||||
|
static field core::double b = 0.5;
|
||||||
|
static field core::bool c = true;
|
||||||
|
static field FutureOr<self::Class>f2 = new self::Class::•();
|
||||||
|
static field core::Function f3 = () → Null {};
|
||||||
|
static field () → dynamic topLevel1 = self::c1.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
||||||
|
static field () → dynamic topLevel2 = self::Extension|get#call(self::i1)<core::int>;
|
||||||
|
static field invalid-type topLevel3 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:61:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Class?'.
|
||||||
|
- 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel3 = c2<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel4 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:62:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'GetterCall'.
|
||||||
|
- 'GetterCall' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel4 = c3<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel5 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:63:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int?'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel5 = i2<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel6 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:64:19: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel6 = f1<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel7 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:65:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel7 = n<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel8 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:66:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel8 = d<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel9 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:67:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel9 = a<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel10 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:68:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'double'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel10 = b<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel11 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:69:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'bool'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel11 = c<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel12 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:70:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'FutureOr<Class>'.
|
||||||
|
- 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel12 = f2<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel13 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:71:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
|
||||||
|
- 'Function' is from 'dart:core'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel13 = f3<int>; // error
|
||||||
|
^";
|
||||||
static method method<T extends self::Class, S extends core::int>(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic {
|
static method method<T extends self::Class, S extends core::int>(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic {
|
||||||
c.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
c.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
||||||
self::Extension|get#call(i)<core::int>;
|
self::Extension|get#call(i)<core::int>;
|
||||||
|
@ -140,7 +267,10 @@ Try changing the operand or remove the type arguments.
|
||||||
Try changing the operand or remove the type arguments.
|
Try changing the operand or remove the type arguments.
|
||||||
s<int>; // error
|
s<int>; // error
|
||||||
^";
|
^";
|
||||||
f1<core::int>;
|
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:35:5: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
f1<int>; // error
|
||||||
|
^";
|
||||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
Try changing the operand or remove the type arguments.
|
Try changing the operand or remove the type arguments.
|
||||||
n<int>; // error
|
n<int>; // error
|
||||||
|
|
|
@ -34,6 +34,11 @@ library /*isNonNullableByDefault*/;
|
||||||
// s<int>; // error
|
// s<int>; // error
|
||||||
// ^
|
// ^
|
||||||
//
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:35:5: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// f1<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
// Try changing the operand or remove the type arguments.
|
// Try changing the operand or remove the type arguments.
|
||||||
// n<int>; // error
|
// n<int>; // error
|
||||||
|
@ -71,6 +76,65 @@ library /*isNonNullableByDefault*/;
|
||||||
// f3<int>; // error
|
// f3<int>; // error
|
||||||
// ^
|
// ^
|
||||||
//
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:61:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Class?'.
|
||||||
|
// - 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel3 = c2<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:62:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'GetterCall'.
|
||||||
|
// - 'GetterCall' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel4 = c3<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:63:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int?'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel5 = i2<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:64:19: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel6 = f1<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:65:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel7 = n<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:66:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel8 = d<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:67:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel9 = a<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:68:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'double'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel10 = b<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:69:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'bool'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel11 = c<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:70:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'FutureOr<Class>'.
|
||||||
|
// - 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel12 = f2<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:71:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
|
||||||
|
// - 'Function' is from 'dart:core'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel13 = f3<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
import self as self;
|
import self as self;
|
||||||
import "dart:core" as core;
|
import "dart:core" as core;
|
||||||
|
|
||||||
|
@ -107,6 +171,69 @@ extension Ambiguous2 on core::String {
|
||||||
method call = self::Ambiguous2|call;
|
method call = self::Ambiguous2|call;
|
||||||
tearoff call = self::Ambiguous2|get#call;
|
tearoff call = self::Ambiguous2|get#call;
|
||||||
}
|
}
|
||||||
|
static field self::Class c1 = new self::Class::•();
|
||||||
|
static field self::Class? c2;
|
||||||
|
static field self::GetterCall c3 = new self::GetterCall::•();
|
||||||
|
static field core::int i1 = 0;
|
||||||
|
static field core::int? i2 = null;
|
||||||
|
static field <T extends core::Object? = dynamic>() →? void f1 = null;
|
||||||
|
static field Never n = throw "";
|
||||||
|
static field dynamic d = null;
|
||||||
|
static field core::String a = "";
|
||||||
|
static field core::double b = 0.5;
|
||||||
|
static field core::bool c = true;
|
||||||
|
static field FutureOr<self::Class>f2 = new self::Class::•();
|
||||||
|
static field core::Function f3 = () → Null {};
|
||||||
|
static field () → dynamic topLevel1 = self::c1.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
||||||
|
static field () → dynamic topLevel2 = self::Extension|get#call(self::i1)<core::int>;
|
||||||
|
static field invalid-type topLevel3 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:61:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Class?'.
|
||||||
|
- 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel3 = c2<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel4 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:62:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'GetterCall'.
|
||||||
|
- 'GetterCall' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel4 = c3<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel5 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:63:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int?'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel5 = i2<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel6 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:64:19: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel6 = f1<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel7 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:65:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel7 = n<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel8 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:66:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel8 = d<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel9 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:67:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel9 = a<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel10 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:68:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'double'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel10 = b<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel11 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:69:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'bool'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel11 = c<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel12 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:70:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'FutureOr<Class>'.
|
||||||
|
- 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel12 = f2<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel13 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:71:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
|
||||||
|
- 'Function' is from 'dart:core'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel13 = f3<int>; // error
|
||||||
|
^";
|
||||||
static method method<T extends self::Class, S extends core::int>(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic {
|
static method method<T extends self::Class, S extends core::int>(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic {
|
||||||
c.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
c.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
||||||
self::Extension|get#call(i)<core::int>;
|
self::Extension|get#call(i)<core::int>;
|
||||||
|
@ -140,7 +267,10 @@ Try changing the operand or remove the type arguments.
|
||||||
Try changing the operand or remove the type arguments.
|
Try changing the operand or remove the type arguments.
|
||||||
s<int>; // error
|
s<int>; // error
|
||||||
^";
|
^";
|
||||||
f1<core::int>;
|
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:35:5: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
f1<int>; // error
|
||||||
|
^";
|
||||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
Try changing the operand or remove the type arguments.
|
Try changing the operand or remove the type arguments.
|
||||||
n<int>; // error
|
n<int>; // error
|
||||||
|
|
|
@ -16,6 +16,32 @@ test<T extends Class?, S extends int>(
|
||||||
bool c,
|
bool c,
|
||||||
FutureOr<Class> f2,
|
FutureOr<Class> f2,
|
||||||
Function f3) {}
|
Function f3) {}
|
||||||
|
Class c1 = Class();
|
||||||
|
Class? c2;
|
||||||
|
GetterCall c3 = GetterCall();
|
||||||
|
int i1 = 0;
|
||||||
|
int? i2 = null;
|
||||||
|
void Function<T>()? f1 = null;
|
||||||
|
Never n = throw '';
|
||||||
|
dynamic d = null;
|
||||||
|
String a = '';
|
||||||
|
double b = 0.5;
|
||||||
|
bool c = true;
|
||||||
|
FutureOr<Class> f2 = Class();
|
||||||
|
Function f3 = () {};
|
||||||
|
var topLevel1 = c1<int>;
|
||||||
|
var topLevel2 = i1<int>;
|
||||||
|
var topLevel3 = c2<int>;
|
||||||
|
var topLevel4 = c3<int>;
|
||||||
|
var topLevel5 = i2<int>;
|
||||||
|
var topLevel6 = f1<int>;
|
||||||
|
var topLevel7 = n<int>;
|
||||||
|
var topLevel8 = d<int>;
|
||||||
|
var topLevel9 = a<int>;
|
||||||
|
var topLevel10 = b<int>;
|
||||||
|
var topLevel11 = c<int>;
|
||||||
|
var topLevel12 = f2<int>;
|
||||||
|
var topLevel13 = f3<int>;
|
||||||
|
|
||||||
class Class {
|
class Class {
|
||||||
call<T>() {}
|
call<T>() {}
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
|
|
||||||
|
Class? c2;
|
||||||
|
Class c1 = Class();
|
||||||
|
Function f3 = () {};
|
||||||
|
FutureOr<Class> f2 = Class();
|
||||||
|
GetterCall c3 = GetterCall();
|
||||||
|
Never n = throw '';
|
||||||
|
String a = '';
|
||||||
|
bool c = true;
|
||||||
|
|
||||||
class Class {
|
class Class {
|
||||||
call<T>() {}
|
call<T>() {}
|
||||||
}
|
}
|
||||||
|
@ -8,6 +17,9 @@ class GetterCall {
|
||||||
void Function<T>() get call => <T>() {};
|
void Function<T>() get call => <T>() {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double b = 0.5;
|
||||||
|
dynamic d = null;
|
||||||
|
|
||||||
extension Ambiguous1 on String {
|
extension Ambiguous1 on String {
|
||||||
call<T>() {}
|
call<T>() {}
|
||||||
}
|
}
|
||||||
|
@ -28,6 +40,8 @@ extension ExtensionSetter on bool {
|
||||||
set call(void Function<T>() value) {}
|
set call(void Function<T>() value) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int? i2 = null;
|
||||||
|
int i1 = 0;
|
||||||
main() {}
|
main() {}
|
||||||
method<T extends Class, S extends int>(Class c, int i, T t, S s) {}
|
method<T extends Class, S extends int>(Class c, int i, T t, S s) {}
|
||||||
test<T extends Class?, S extends int>(
|
test<T extends Class?, S extends int>(
|
||||||
|
@ -45,3 +59,17 @@ test<T extends Class?, S extends int>(
|
||||||
bool c,
|
bool c,
|
||||||
FutureOr<Class> f2,
|
FutureOr<Class> f2,
|
||||||
Function f3) {}
|
Function f3) {}
|
||||||
|
var topLevel1 = c1<int>;
|
||||||
|
var topLevel10 = b<int>;
|
||||||
|
var topLevel11 = c<int>;
|
||||||
|
var topLevel12 = f2<int>;
|
||||||
|
var topLevel13 = f3<int>;
|
||||||
|
var topLevel2 = i1<int>;
|
||||||
|
var topLevel3 = c2<int>;
|
||||||
|
var topLevel4 = c3<int>;
|
||||||
|
var topLevel5 = i2<int>;
|
||||||
|
var topLevel6 = f1<int>;
|
||||||
|
var topLevel7 = n<int>;
|
||||||
|
var topLevel8 = d<int>;
|
||||||
|
var topLevel9 = a<int>;
|
||||||
|
void Function<T>()? f1 = null;
|
||||||
|
|
|
@ -34,6 +34,11 @@ library /*isNonNullableByDefault*/;
|
||||||
// s<int>; // error
|
// s<int>; // error
|
||||||
// ^
|
// ^
|
||||||
//
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:35:5: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// f1<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
// Try changing the operand or remove the type arguments.
|
// Try changing the operand or remove the type arguments.
|
||||||
// n<int>; // error
|
// n<int>; // error
|
||||||
|
@ -71,6 +76,65 @@ library /*isNonNullableByDefault*/;
|
||||||
// f3<int>; // error
|
// f3<int>; // error
|
||||||
// ^
|
// ^
|
||||||
//
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:61:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Class?'.
|
||||||
|
// - 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel3 = c2<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:62:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'GetterCall'.
|
||||||
|
// - 'GetterCall' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel4 = c3<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:63:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int?'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel5 = i2<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:64:19: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel6 = f1<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:65:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel7 = n<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:66:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel8 = d<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:67:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel9 = a<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:68:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'double'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel10 = b<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:69:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'bool'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel11 = c<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:70:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'FutureOr<Class>'.
|
||||||
|
// - 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel12 = f2<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:71:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
|
||||||
|
// - 'Function' is from 'dart:core'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel13 = f3<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
import self as self;
|
import self as self;
|
||||||
import "dart:core" as core;
|
import "dart:core" as core;
|
||||||
|
|
||||||
|
@ -107,6 +171,69 @@ extension Ambiguous2 on core::String {
|
||||||
method call = self::Ambiguous2|call;
|
method call = self::Ambiguous2|call;
|
||||||
tearoff call = self::Ambiguous2|get#call;
|
tearoff call = self::Ambiguous2|get#call;
|
||||||
}
|
}
|
||||||
|
static field self::Class c1 = new self::Class::•();
|
||||||
|
static field self::Class? c2;
|
||||||
|
static field self::GetterCall c3 = new self::GetterCall::•();
|
||||||
|
static field core::int i1 = 0;
|
||||||
|
static field core::int? i2 = null;
|
||||||
|
static field <T extends core::Object? = dynamic>() →? void f1 = null;
|
||||||
|
static field Never n = throw "";
|
||||||
|
static field dynamic d = null;
|
||||||
|
static field core::String a = "";
|
||||||
|
static field core::double b = 0.5;
|
||||||
|
static field core::bool c = true;
|
||||||
|
static field FutureOr<self::Class>f2 = new self::Class::•();
|
||||||
|
static field core::Function f3 = () → Null {};
|
||||||
|
static field () → dynamic topLevel1 = self::c1.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
||||||
|
static field () → dynamic topLevel2 = self::Extension|get#call(self::i1)<core::int>;
|
||||||
|
static field invalid-type topLevel3 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:61:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Class?'.
|
||||||
|
- 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel3 = c2<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel4 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:62:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'GetterCall'.
|
||||||
|
- 'GetterCall' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel4 = c3<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel5 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:63:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int?'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel5 = i2<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel6 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:64:19: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel6 = f1<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel7 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:65:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel7 = n<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel8 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:66:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel8 = d<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel9 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:67:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel9 = a<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel10 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:68:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'double'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel10 = b<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel11 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:69:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'bool'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel11 = c<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel12 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:70:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'FutureOr<Class>'.
|
||||||
|
- 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel12 = f2<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel13 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:71:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
|
||||||
|
- 'Function' is from 'dart:core'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel13 = f3<int>; // error
|
||||||
|
^";
|
||||||
static method method<T extends self::Class, S extends core::int>(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic {
|
static method method<T extends self::Class, S extends core::int>(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic {
|
||||||
c.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
c.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
||||||
self::Extension|get#call(i)<core::int>;
|
self::Extension|get#call(i)<core::int>;
|
||||||
|
@ -140,7 +267,10 @@ Try changing the operand or remove the type arguments.
|
||||||
Try changing the operand or remove the type arguments.
|
Try changing the operand or remove the type arguments.
|
||||||
s<int>; // error
|
s<int>; // error
|
||||||
^";
|
^";
|
||||||
f1<core::int>;
|
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:35:5: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
f1<int>; // error
|
||||||
|
^";
|
||||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
Try changing the operand or remove the type arguments.
|
Try changing the operand or remove the type arguments.
|
||||||
n<int>; // error
|
n<int>; // error
|
||||||
|
|
|
@ -34,6 +34,32 @@ extension Ambiguous2 on core::String {
|
||||||
method call = self::Ambiguous2|call;
|
method call = self::Ambiguous2|call;
|
||||||
tearoff call = self::Ambiguous2|get#call;
|
tearoff call = self::Ambiguous2|get#call;
|
||||||
}
|
}
|
||||||
|
static field self::Class c1;
|
||||||
|
static field self::Class? c2;
|
||||||
|
static field self::GetterCall c3;
|
||||||
|
static field core::int i1;
|
||||||
|
static field core::int? i2;
|
||||||
|
static field <T extends core::Object? = dynamic>() →? void f1;
|
||||||
|
static field Never n;
|
||||||
|
static field dynamic d;
|
||||||
|
static field core::String a;
|
||||||
|
static field core::double b;
|
||||||
|
static field core::bool c;
|
||||||
|
static field FutureOr<self::Class>f2;
|
||||||
|
static field core::Function f3;
|
||||||
|
static field () → dynamic topLevel1;
|
||||||
|
static field () → dynamic topLevel2;
|
||||||
|
static field invalid-type topLevel3;
|
||||||
|
static field invalid-type topLevel4;
|
||||||
|
static field invalid-type topLevel5;
|
||||||
|
static field invalid-type topLevel6;
|
||||||
|
static field invalid-type topLevel7;
|
||||||
|
static field invalid-type topLevel8;
|
||||||
|
static field invalid-type topLevel9;
|
||||||
|
static field invalid-type topLevel10;
|
||||||
|
static field invalid-type topLevel11;
|
||||||
|
static field invalid-type topLevel12;
|
||||||
|
static field invalid-type topLevel13;
|
||||||
static method method<T extends self::Class, S extends core::int>(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic
|
static method method<T extends self::Class, S extends core::int>(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic
|
||||||
;
|
;
|
||||||
static method test<T extends self::Class?, S extends core::int>(self::Class? c1, self::GetterCall c2, core::int? i, self::test::T% t1, self::test::T? t2, self::test::S? s, <T extends core::Object? = dynamic>() →? void f1, Never n, dynamic d, core::String a, core::double b, core::bool c, FutureOr<self::Class>f2, core::Function f3) → dynamic
|
static method test<T extends self::Class?, S extends core::int>(self::Class? c1, self::GetterCall c2, core::int? i, self::test::T% t1, self::test::T? t2, self::test::S? s, <T extends core::Object? = dynamic>() →? void f1, Never n, dynamic d, core::String a, core::double b, core::bool c, FutureOr<self::Class>f2, core::Function f3) → dynamic
|
||||||
|
|
|
@ -34,6 +34,11 @@ library /*isNonNullableByDefault*/;
|
||||||
// s<int>; // error
|
// s<int>; // error
|
||||||
// ^
|
// ^
|
||||||
//
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:35:5: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// f1<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
// Try changing the operand or remove the type arguments.
|
// Try changing the operand or remove the type arguments.
|
||||||
// n<int>; // error
|
// n<int>; // error
|
||||||
|
@ -71,6 +76,65 @@ library /*isNonNullableByDefault*/;
|
||||||
// f3<int>; // error
|
// f3<int>; // error
|
||||||
// ^
|
// ^
|
||||||
//
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:61:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Class?'.
|
||||||
|
// - 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel3 = c2<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:62:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'GetterCall'.
|
||||||
|
// - 'GetterCall' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel4 = c3<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:63:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int?'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel5 = i2<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:64:19: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel6 = f1<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:65:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel7 = n<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:66:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel8 = d<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:67:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel9 = a<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:68:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'double'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel10 = b<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:69:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'bool'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel11 = c<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:70:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'FutureOr<Class>'.
|
||||||
|
// - 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel12 = f2<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
|
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:71:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
|
||||||
|
// - 'Function' is from 'dart:core'.
|
||||||
|
// Try changing the operand or remove the type arguments.
|
||||||
|
// var topLevel13 = f3<int>; // error
|
||||||
|
// ^
|
||||||
|
//
|
||||||
import self as self;
|
import self as self;
|
||||||
import "dart:core" as core;
|
import "dart:core" as core;
|
||||||
|
|
||||||
|
@ -107,6 +171,69 @@ extension Ambiguous2 on core::String {
|
||||||
method call = self::Ambiguous2|call;
|
method call = self::Ambiguous2|call;
|
||||||
tearoff call = self::Ambiguous2|get#call;
|
tearoff call = self::Ambiguous2|get#call;
|
||||||
}
|
}
|
||||||
|
static field self::Class c1 = new self::Class::•();
|
||||||
|
static field self::Class? c2;
|
||||||
|
static field self::GetterCall c3 = new self::GetterCall::•();
|
||||||
|
static field core::int i1 = 0;
|
||||||
|
static field core::int? i2 = null;
|
||||||
|
static field <T extends core::Object? = dynamic>() →? void f1 = null;
|
||||||
|
static field Never n = throw "";
|
||||||
|
static field dynamic d = null;
|
||||||
|
static field core::String a = "";
|
||||||
|
static field core::double b = 0.5;
|
||||||
|
static field core::bool c = true;
|
||||||
|
static field FutureOr<self::Class>f2 = new self::Class::•();
|
||||||
|
static field core::Function f3 = () → Null {};
|
||||||
|
static field () → dynamic topLevel1 = self::c1.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
||||||
|
static field () → dynamic topLevel2 = self::Extension|get#call(self::i1)<core::int>;
|
||||||
|
static field invalid-type topLevel3 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:61:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Class?'.
|
||||||
|
- 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel3 = c2<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel4 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:62:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'GetterCall'.
|
||||||
|
- 'GetterCall' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel4 = c3<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel5 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:63:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'int?'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel5 = i2<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel6 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:64:19: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel6 = f1<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel7 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:65:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel7 = n<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel8 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:66:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'dynamic'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel8 = d<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel9 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:67:18: Error: The static type of the explicit instantiation operand must be a generic function type but is 'String'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel9 = a<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel10 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:68:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'double'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel10 = b<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel11 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:69:19: Error: The static type of the explicit instantiation operand must be a generic function type but is 'bool'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel11 = c<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel12 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:70:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'FutureOr<Class>'.
|
||||||
|
- 'Class' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel12 = f2<int>; // error
|
||||||
|
^";
|
||||||
|
static field invalid-type topLevel13 = invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:71:20: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Function'.
|
||||||
|
- 'Function' is from 'dart:core'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
var topLevel13 = f3<int>; // error
|
||||||
|
^";
|
||||||
static method method<T extends self::Class, S extends core::int>(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic {
|
static method method<T extends self::Class, S extends core::int>(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic {
|
||||||
c.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
c.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
||||||
self::Extension|get#call(i)<core::int>;
|
self::Extension|get#call(i)<core::int>;
|
||||||
|
@ -140,7 +267,10 @@ Try changing the operand or remove the type arguments.
|
||||||
Try changing the operand or remove the type arguments.
|
Try changing the operand or remove the type arguments.
|
||||||
s<int>; // error
|
s<int>; // error
|
||||||
^";
|
^";
|
||||||
f1<core::int>;
|
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:35:5: Error: The static type of the explicit instantiation operand must be a non-null generic function type but is 'void Function<T>()?'.
|
||||||
|
Try changing the operand or remove the type arguments.
|
||||||
|
f1<int>; // error
|
||||||
|
^";
|
||||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:36:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'Never'.
|
||||||
Try changing the operand or remove the type arguments.
|
Try changing the operand or remove the type arguments.
|
||||||
n<int>; // error
|
n<int>; // error
|
||||||
|
|
Loading…
Reference in a new issue