diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart index 53468abd036..66e0e8599e3 100644 --- a/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart +++ b/pkg/front_end/lib/src/fasta/fasta_codes_cfe_generated.dart @@ -2100,6 +2100,37 @@ Message _withArgumentsInstantiationNonGenericFunctionType( arguments: {'type': _type}); } +// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE. +const Template + 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 + codeInstantiationNullableGenericFunctionType = + const Code( + "InstantiationNullableGenericFunctionType", + analyzerCodes: ["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 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. const Template< Message Function( diff --git a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart index 29fa3a24267..91cd4ffa280 100644 --- a/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart +++ b/pkg/front_end/lib/src/fasta/kernel/inference_visitor.dart @@ -412,12 +412,24 @@ class InferenceVisitor DartType resultType = const InvalidType(); if (operandType is FunctionType) { if (operandType.typeParameters.length == node.typeArguments.length) { - inferrer.checkBoundsInInstantiation( - operandType, node.typeArguments, node.fileOffset, - inferred: false); - resultType = Substitution.fromPairs( - operandType.typeParameters, node.typeArguments) - .substituteType(operandType.withoutTypeParameters); + if (!inferrer.isTopLevel) { + inferrer.checkBoundsInInstantiation( + operandType, node.typeArguments, node.fileOffset, + inferred: false); + } + 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 { if (!inferrer.isTopLevel) { if (operandType.typeParameters.isEmpty) { diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml index 439bdf61af2..dc7740029a3 100644 --- a/pkg/front_end/messages.yaml +++ b/pkg/front_end/messages.yaml @@ -5355,6 +5355,14 @@ InstantiationNonGenericFunctionType: f() {} main() => f; +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()? f) => f; + InstantiationTooFewArguments: problemMessage: "Too few type arguments: #count required, #count2 given." correctionMessage: "Try adding the missing type arguments." diff --git a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart index 692cc2094f5..c8b971cfa4f 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart +++ b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart @@ -42,6 +42,34 @@ test( f3; // error } +Class c1 = Class(); +Class? c2; +GetterCall c3 = GetterCall(); +int i1 = 0; +int? i2 = null; +void Function()? f1 = null; +Never n = throw ''; +dynamic d = null; +String a = ''; +double b = 0.5; +bool c = true; +FutureOr f2 = Class(); +Function f3 = () {}; + +var topLevel1 = c1; // ok +var topLevel2 = i1; // ok +var topLevel3 = c2; // error +var topLevel4 = c3; // error +var topLevel5 = i2; // error +var topLevel6 = f1; // error +var topLevel7 = n; // error +var topLevel8 = d; // error +var topLevel9 = a; // error +var topLevel10 = b; // error +var topLevel11 = c; // error +var topLevel12 = f2; // error +var topLevel13 = f3; // error + class Class { call() {} } diff --git a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.strong.expect b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.strong.expect index 22706899224..bb11cff8b8a 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.strong.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.strong.expect @@ -34,6 +34,11 @@ library /*isNonNullableByDefault*/; // s; // 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()?'. +// Try changing the operand or remove the type arguments. +// f1; // 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'. // Try changing the operand or remove the type arguments. // n; // error @@ -71,6 +76,65 @@ library /*isNonNullableByDefault*/; // f3; // 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; // 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; // 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; // 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()?'. +// Try changing the operand or remove the type arguments. +// var topLevel6 = f1; // 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; // 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; // 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; // 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; // 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; // 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' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'. +// Try changing the operand or remove the type arguments. +// var topLevel12 = f2; // 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; // error +// ^ +// import self as self; import "dart:core" as core; @@ -107,6 +171,69 @@ extension Ambiguous2 on core::String { method call = self::Ambiguous2|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 () →? 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 FutureOrf2 = new self::Class::•(); +static field core::Function f3 = () → Null {}; +static field () → dynamic topLevel1 = self::c1.{self::Class::call}{() → dynamic}; +static field () → dynamic topLevel2 = self::Extension|get#call(self::i1); +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; // 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; // 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; // 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()?'. +Try changing the operand or remove the type arguments. +var topLevel6 = f1; // 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; // 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; // 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; // 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; // 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; // 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' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'. +Try changing the operand or remove the type arguments. +var topLevel12 = f2; // 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; // error + ^"; static method method(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic { c.{self::Class::call}{() → dynamic}; self::Extension|get#call(i); @@ -140,7 +267,10 @@ Try changing the operand or remove the type arguments. Try changing the operand or remove the type arguments. s; // error ^"; - f1; + 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()?'. +Try changing the operand or remove the type arguments. + f1; // 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'. Try changing the operand or remove the type arguments. n; // error diff --git a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.strong.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.strong.transformed.expect index 22706899224..bb11cff8b8a 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.strong.transformed.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.strong.transformed.expect @@ -34,6 +34,11 @@ library /*isNonNullableByDefault*/; // s; // 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()?'. +// Try changing the operand or remove the type arguments. +// f1; // 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'. // Try changing the operand or remove the type arguments. // n; // error @@ -71,6 +76,65 @@ library /*isNonNullableByDefault*/; // f3; // 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; // 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; // 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; // 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()?'. +// Try changing the operand or remove the type arguments. +// var topLevel6 = f1; // 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; // 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; // 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; // 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; // 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; // 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' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'. +// Try changing the operand or remove the type arguments. +// var topLevel12 = f2; // 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; // error +// ^ +// import self as self; import "dart:core" as core; @@ -107,6 +171,69 @@ extension Ambiguous2 on core::String { method call = self::Ambiguous2|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 () →? 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 FutureOrf2 = new self::Class::•(); +static field core::Function f3 = () → Null {}; +static field () → dynamic topLevel1 = self::c1.{self::Class::call}{() → dynamic}; +static field () → dynamic topLevel2 = self::Extension|get#call(self::i1); +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; // 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; // 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; // 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()?'. +Try changing the operand or remove the type arguments. +var topLevel6 = f1; // 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; // 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; // 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; // 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; // 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; // 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' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'. +Try changing the operand or remove the type arguments. +var topLevel12 = f2; // 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; // error + ^"; static method method(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic { c.{self::Class::call}{() → dynamic}; self::Extension|get#call(i); @@ -140,7 +267,10 @@ Try changing the operand or remove the type arguments. Try changing the operand or remove the type arguments. s; // error ^"; - f1; + 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()?'. +Try changing the operand or remove the type arguments. + f1; // 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'. Try changing the operand or remove the type arguments. n; // error diff --git a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.textual_outline.expect b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.textual_outline.expect index 807f530b6c1..1828544ec88 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.textual_outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.textual_outline.expect @@ -16,6 +16,32 @@ test( bool c, FutureOr f2, Function f3) {} +Class c1 = Class(); +Class? c2; +GetterCall c3 = GetterCall(); +int i1 = 0; +int? i2 = null; +void Function()? f1 = null; +Never n = throw ''; +dynamic d = null; +String a = ''; +double b = 0.5; +bool c = true; +FutureOr f2 = Class(); +Function f3 = () {}; +var topLevel1 = c1; +var topLevel2 = i1; +var topLevel3 = c2; +var topLevel4 = c3; +var topLevel5 = i2; +var topLevel6 = f1; +var topLevel7 = n; +var topLevel8 = d; +var topLevel9 = a; +var topLevel10 = b; +var topLevel11 = c; +var topLevel12 = f2; +var topLevel13 = f3; class Class { call() {} diff --git a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.textual_outline_modelled.expect b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.textual_outline_modelled.expect index 5c31ac304ff..3b6ec7ee1f2 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.textual_outline_modelled.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.textual_outline_modelled.expect @@ -1,5 +1,14 @@ import 'dart:async'; +Class? c2; +Class c1 = Class(); +Function f3 = () {}; +FutureOr f2 = Class(); +GetterCall c3 = GetterCall(); +Never n = throw ''; +String a = ''; +bool c = true; + class Class { call() {} } @@ -8,6 +17,9 @@ class GetterCall { void Function() get call => () {}; } +double b = 0.5; +dynamic d = null; + extension Ambiguous1 on String { call() {} } @@ -28,6 +40,8 @@ extension ExtensionSetter on bool { set call(void Function() value) {} } +int? i2 = null; +int i1 = 0; main() {} method(Class c, int i, T t, S s) {} test( @@ -45,3 +59,17 @@ test( bool c, FutureOr f2, Function f3) {} +var topLevel1 = c1; +var topLevel10 = b; +var topLevel11 = c; +var topLevel12 = f2; +var topLevel13 = f3; +var topLevel2 = i1; +var topLevel3 = c2; +var topLevel4 = c3; +var topLevel5 = i2; +var topLevel6 = f1; +var topLevel7 = n; +var topLevel8 = d; +var topLevel9 = a; +void Function()? f1 = null; diff --git a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.weak.expect b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.weak.expect index 22706899224..bb11cff8b8a 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.weak.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.weak.expect @@ -34,6 +34,11 @@ library /*isNonNullableByDefault*/; // s; // 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()?'. +// Try changing the operand or remove the type arguments. +// f1; // 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'. // Try changing the operand or remove the type arguments. // n; // error @@ -71,6 +76,65 @@ library /*isNonNullableByDefault*/; // f3; // 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; // 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; // 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; // 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()?'. +// Try changing the operand or remove the type arguments. +// var topLevel6 = f1; // 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; // 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; // 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; // 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; // 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; // 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' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'. +// Try changing the operand or remove the type arguments. +// var topLevel12 = f2; // 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; // error +// ^ +// import self as self; import "dart:core" as core; @@ -107,6 +171,69 @@ extension Ambiguous2 on core::String { method call = self::Ambiguous2|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 () →? 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 FutureOrf2 = new self::Class::•(); +static field core::Function f3 = () → Null {}; +static field () → dynamic topLevel1 = self::c1.{self::Class::call}{() → dynamic}; +static field () → dynamic topLevel2 = self::Extension|get#call(self::i1); +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; // 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; // 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; // 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()?'. +Try changing the operand or remove the type arguments. +var topLevel6 = f1; // 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; // 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; // 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; // 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; // 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; // 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' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'. +Try changing the operand or remove the type arguments. +var topLevel12 = f2; // 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; // error + ^"; static method method(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic { c.{self::Class::call}{() → dynamic}; self::Extension|get#call(i); @@ -140,7 +267,10 @@ Try changing the operand or remove the type arguments. Try changing the operand or remove the type arguments. s; // error ^"; - f1; + 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()?'. +Try changing the operand or remove the type arguments. + f1; // 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'. Try changing the operand or remove the type arguments. n; // error diff --git a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.weak.outline.expect b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.weak.outline.expect index a47d8130842..8f355285692 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.weak.outline.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.weak.outline.expect @@ -34,6 +34,32 @@ extension Ambiguous2 on core::String { method call = self::Ambiguous2|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 () →? 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 FutureOrf2; +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(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic ; static method test(self::Class? c1, self::GetterCall c2, core::int? i, self::test::T% t1, self::test::T? t2, self::test::S? s, () →? void f1, Never n, dynamic d, core::String a, core::double b, core::bool c, FutureOrf2, core::Function f3) → dynamic diff --git a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.weak.transformed.expect b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.weak.transformed.expect index 22706899224..bb11cff8b8a 100644 --- a/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.weak.transformed.expect +++ b/pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart.weak.transformed.expect @@ -34,6 +34,11 @@ library /*isNonNullableByDefault*/; // s; // 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()?'. +// Try changing the operand or remove the type arguments. +// f1; // 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'. // Try changing the operand or remove the type arguments. // n; // error @@ -71,6 +76,65 @@ library /*isNonNullableByDefault*/; // f3; // 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; // 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; // 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; // 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()?'. +// Try changing the operand or remove the type arguments. +// var topLevel6 = f1; // 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; // 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; // 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; // 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; // 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; // 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' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'. +// Try changing the operand or remove the type arguments. +// var topLevel12 = f2; // 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; // error +// ^ +// import self as self; import "dart:core" as core; @@ -107,6 +171,69 @@ extension Ambiguous2 on core::String { method call = self::Ambiguous2|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 () →? 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 FutureOrf2 = new self::Class::•(); +static field core::Function f3 = () → Null {}; +static field () → dynamic topLevel1 = self::c1.{self::Class::call}{() → dynamic}; +static field () → dynamic topLevel2 = self::Extension|get#call(self::i1); +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; // 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; // 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; // 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()?'. +Try changing the operand or remove the type arguments. +var topLevel6 = f1; // 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; // 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; // 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; // 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; // 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; // 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' is from 'pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart'. +Try changing the operand or remove the type arguments. +var topLevel12 = f2; // 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; // error + ^"; static method method(self::Class c, core::int i, self::method::T t, self::method::S s) → dynamic { c.{self::Class::call}{() → dynamic}; self::Extension|get#call(i); @@ -140,7 +267,10 @@ Try changing the operand or remove the type arguments. Try changing the operand or remove the type arguments. s; // error ^"; - f1; + 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()?'. +Try changing the operand or remove the type arguments. + f1; // 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'. Try changing the operand or remove the type arguments. n; // error