mirror of
https://github.com/dart-lang/sdk
synced 2024-10-14 09:22:12 +00:00
[cfe] Support implicit tear off in explicit instantiation
Part of https://github.com/dart-lang/sdk/issues/46232 Change-Id: I578ae9d78dd71da40630a3d6da75c4344876944b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215021 Commit-Queue: Johnni Winther <johnniwinther@google.com> Reviewed-by: Chloe Stefantsova <dmitryas@google.com>
This commit is contained in:
parent
81839ddcc1
commit
5574b1e59f
|
@ -364,8 +364,50 @@ class InferenceVisitor
|
|||
ExpressionInferenceResult operandResult = inferrer.inferExpression(
|
||||
node.expression, const UnknownType(), true,
|
||||
isVoidAllowed: true);
|
||||
node.expression = operandResult.expression..parent = node;
|
||||
Expression operand = operandResult.expression;
|
||||
DartType operandType = operandResult.inferredType;
|
||||
if (operandType is! FunctionType) {
|
||||
ObjectAccessTarget callMember = inferrer.findInterfaceMember(
|
||||
operandType, callName, operand.fileOffset,
|
||||
callSiteAccessKind: CallSiteAccessKind.getterInvocation,
|
||||
includeExtensionMethods: true);
|
||||
switch (callMember.kind) {
|
||||
case ObjectAccessTargetKind.instanceMember:
|
||||
Member? target = callMember.member;
|
||||
if (target is Procedure && target.kind == ProcedureKind.Method) {
|
||||
operandType = inferrer.getGetterType(callMember, operandType);
|
||||
operand = new InstanceTearOff(
|
||||
InstanceAccessKind.Instance, operand, callName,
|
||||
interfaceTarget: target, resultType: operandType)
|
||||
..fileOffset = operand.fileOffset;
|
||||
}
|
||||
break;
|
||||
case ObjectAccessTargetKind.extensionMember:
|
||||
if (callMember.tearoffTarget != null &&
|
||||
callMember.extensionMethodKind == ProcedureKind.Method) {
|
||||
operandType = inferrer.getGetterType(callMember, operandType);
|
||||
operand = new StaticInvocation(
|
||||
callMember.tearoffTarget as Procedure,
|
||||
new Arguments(<Expression>[operand],
|
||||
types: callMember.inferredExtensionTypeArguments)
|
||||
..fileOffset = operand.fileOffset)
|
||||
..fileOffset = operand.fileOffset;
|
||||
}
|
||||
break;
|
||||
case ObjectAccessTargetKind.nullableInstanceMember:
|
||||
case ObjectAccessTargetKind.objectMember:
|
||||
case ObjectAccessTargetKind.nullableCallFunction:
|
||||
case ObjectAccessTargetKind.nullableExtensionMember:
|
||||
case ObjectAccessTargetKind.dynamic:
|
||||
case ObjectAccessTargetKind.never:
|
||||
case ObjectAccessTargetKind.invalid:
|
||||
case ObjectAccessTargetKind.missing:
|
||||
case ObjectAccessTargetKind.ambiguous:
|
||||
case ObjectAccessTargetKind.callFunction:
|
||||
break;
|
||||
}
|
||||
}
|
||||
node.expression = operand..parent = node;
|
||||
Expression result = node;
|
||||
DartType resultType = const InvalidType();
|
||||
if (operandType is FunctionType) {
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'dart:async';
|
||||
|
||||
method<T extends Class, S extends int>(Class c, int i, T t, S s) {
|
||||
c<int>; // ok
|
||||
i<int>; // ok
|
||||
t<int>; // ok
|
||||
s<int>; // ok
|
||||
}
|
||||
|
||||
test<T extends Class?, S extends int>(
|
||||
Class? c1,
|
||||
GetterCall c2,
|
||||
int? i,
|
||||
T t1,
|
||||
T? t2,
|
||||
S? s,
|
||||
void Function<T>()? f1,
|
||||
Never n,
|
||||
dynamic d,
|
||||
String a,
|
||||
double b,
|
||||
bool c,
|
||||
FutureOr<Class> f2,
|
||||
Function f3) {
|
||||
c1<int>; // error
|
||||
c2<int>; // error
|
||||
i<int>; // error
|
||||
t1<int>; // error
|
||||
t2<int>; // error
|
||||
s<int>; // error
|
||||
f1<int>; // error
|
||||
n<int>; // error
|
||||
d<int>; // error
|
||||
a<int>; // error
|
||||
b<int>; // error
|
||||
c<int>; // error
|
||||
f2<int>; // error
|
||||
f3<int>; // error
|
||||
}
|
||||
|
||||
class Class {
|
||||
call<T>() {}
|
||||
}
|
||||
|
||||
class GetterCall {
|
||||
void Function<T>() get call => <T>() {};
|
||||
}
|
||||
|
||||
extension Extension on int {
|
||||
call<T>() {}
|
||||
}
|
||||
|
||||
extension ExtensionGetter on double {
|
||||
void Function<T>() get call => <T>() {};
|
||||
}
|
||||
|
||||
extension ExtensionSetter on bool {
|
||||
set call(void Function<T>() value) {}
|
||||
}
|
||||
|
||||
extension Ambiguous1 on String {
|
||||
call<T>() {}
|
||||
}
|
||||
|
||||
extension Ambiguous2 on String {
|
||||
call<T>() {}
|
||||
}
|
||||
|
||||
main() {
|
||||
method(Class(), 0, Class(), 0);
|
||||
}
|
|
@ -0,0 +1,189 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:29:5: 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.
|
||||
// c1<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:30:5: 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.
|
||||
// c2<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:31:4: 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.
|
||||
// i<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:32:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// t1<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:33:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T?'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// t2<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:34:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'S?'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// s<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'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// n<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:37:4: 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.
|
||||
// d<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:38:4: 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.
|
||||
// a<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:39:4: 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.
|
||||
// b<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:40:4: 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.
|
||||
// c<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:41:5: 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.
|
||||
// f2<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:42:5: 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.
|
||||
// f3<int>; // error
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
class Class extends core::Object {
|
||||
synthetic constructor •() → self::Class
|
||||
: super core::Object::•()
|
||||
;
|
||||
method call<T extends core::Object? = dynamic>() → dynamic {}
|
||||
}
|
||||
class GetterCall extends core::Object {
|
||||
synthetic constructor •() → self::GetterCall
|
||||
: super core::Object::•()
|
||||
;
|
||||
get call() → <T extends core::Object? = dynamic>() → void
|
||||
return <T extends core::Object? = dynamic>() → void {};
|
||||
}
|
||||
extension Extension on core::int {
|
||||
method call = self::Extension|call;
|
||||
tearoff call = self::Extension|get#call;
|
||||
}
|
||||
extension ExtensionGetter on core::double {
|
||||
get call = self::ExtensionGetter|get#call;
|
||||
}
|
||||
extension ExtensionSetter on core::bool {
|
||||
set call = self::ExtensionSetter|set#call;
|
||||
}
|
||||
extension Ambiguous1 on core::String {
|
||||
method call = self::Ambiguous1|call;
|
||||
tearoff call = self::Ambiguous1|get#call;
|
||||
}
|
||||
extension Ambiguous2 on core::String {
|
||||
method call = self::Ambiguous2|call;
|
||||
tearoff call = self::Ambiguous2|get#call;
|
||||
}
|
||||
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>;
|
||||
self::Extension|get#call(i)<core::int>;
|
||||
t.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
||||
self::Extension|get#call(s)<core::int>;
|
||||
}
|
||||
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 {
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:29:5: 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.
|
||||
c1<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:30:5: 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.
|
||||
c2<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:31:4: 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.
|
||||
i<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:32:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'.
|
||||
Try changing the operand or remove the type arguments.
|
||||
t1<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:33:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T?'.
|
||||
Try changing the operand or remove the type arguments.
|
||||
t2<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:34:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'S?'.
|
||||
Try changing the operand or remove the type arguments.
|
||||
s<int>; // error
|
||||
^";
|
||||
f1<core::int>;
|
||||
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<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:37:4: 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.
|
||||
d<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:38:4: 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.
|
||||
a<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:39:4: 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.
|
||||
b<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:40:4: 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.
|
||||
c<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:41:5: 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.
|
||||
f2<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:42:5: 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.
|
||||
f3<int>; // error
|
||||
^";
|
||||
}
|
||||
static method Extension|call<T extends core::Object? = dynamic>(lowered final core::int #this) → dynamic {}
|
||||
static method Extension|get#call(lowered final core::int #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Extension|call<T%>(#this);
|
||||
static method ExtensionGetter|get#call(lowered final core::double #this) → <T extends core::Object? = dynamic>() → void
|
||||
return <T extends core::Object? = dynamic>() → void {};
|
||||
static method ExtensionSetter|set#call(lowered final core::bool #this, <T extends core::Object? = dynamic>() → void value) → void {}
|
||||
static method Ambiguous1|call<T extends core::Object? = dynamic>(lowered final core::String #this) → dynamic {}
|
||||
static method Ambiguous1|get#call(lowered final core::String #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Ambiguous1|call<T%>(#this);
|
||||
static method Ambiguous2|call<T extends core::Object? = dynamic>(lowered final core::String #this) → dynamic {}
|
||||
static method Ambiguous2|get#call(lowered final core::String #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Ambiguous2|call<T%>(#this);
|
||||
static method main() → dynamic {
|
||||
self::method<self::Class, core::int>(new self::Class::•(), 0, new self::Class::•(), 0);
|
||||
}
|
|
@ -0,0 +1,189 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:29:5: 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.
|
||||
// c1<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:30:5: 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.
|
||||
// c2<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:31:4: 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.
|
||||
// i<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:32:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// t1<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:33:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T?'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// t2<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:34:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'S?'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// s<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'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// n<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:37:4: 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.
|
||||
// d<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:38:4: 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.
|
||||
// a<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:39:4: 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.
|
||||
// b<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:40:4: 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.
|
||||
// c<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:41:5: 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.
|
||||
// f2<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:42:5: 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.
|
||||
// f3<int>; // error
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
class Class extends core::Object {
|
||||
synthetic constructor •() → self::Class
|
||||
: super core::Object::•()
|
||||
;
|
||||
method call<T extends core::Object? = dynamic>() → dynamic {}
|
||||
}
|
||||
class GetterCall extends core::Object {
|
||||
synthetic constructor •() → self::GetterCall
|
||||
: super core::Object::•()
|
||||
;
|
||||
get call() → <T extends core::Object? = dynamic>() → void
|
||||
return <T extends core::Object? = dynamic>() → void {};
|
||||
}
|
||||
extension Extension on core::int {
|
||||
method call = self::Extension|call;
|
||||
tearoff call = self::Extension|get#call;
|
||||
}
|
||||
extension ExtensionGetter on core::double {
|
||||
get call = self::ExtensionGetter|get#call;
|
||||
}
|
||||
extension ExtensionSetter on core::bool {
|
||||
set call = self::ExtensionSetter|set#call;
|
||||
}
|
||||
extension Ambiguous1 on core::String {
|
||||
method call = self::Ambiguous1|call;
|
||||
tearoff call = self::Ambiguous1|get#call;
|
||||
}
|
||||
extension Ambiguous2 on core::String {
|
||||
method call = self::Ambiguous2|call;
|
||||
tearoff call = self::Ambiguous2|get#call;
|
||||
}
|
||||
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>;
|
||||
self::Extension|get#call(i)<core::int>;
|
||||
t.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
||||
self::Extension|get#call(s)<core::int>;
|
||||
}
|
||||
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 {
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:29:5: 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.
|
||||
c1<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:30:5: 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.
|
||||
c2<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:31:4: 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.
|
||||
i<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:32:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'.
|
||||
Try changing the operand or remove the type arguments.
|
||||
t1<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:33:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T?'.
|
||||
Try changing the operand or remove the type arguments.
|
||||
t2<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:34:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'S?'.
|
||||
Try changing the operand or remove the type arguments.
|
||||
s<int>; // error
|
||||
^";
|
||||
f1<core::int>;
|
||||
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<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:37:4: 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.
|
||||
d<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:38:4: 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.
|
||||
a<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:39:4: 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.
|
||||
b<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:40:4: 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.
|
||||
c<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:41:5: 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.
|
||||
f2<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:42:5: 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.
|
||||
f3<int>; // error
|
||||
^";
|
||||
}
|
||||
static method Extension|call<T extends core::Object? = dynamic>(lowered final core::int #this) → dynamic {}
|
||||
static method Extension|get#call(lowered final core::int #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Extension|call<T%>(#this);
|
||||
static method ExtensionGetter|get#call(lowered final core::double #this) → <T extends core::Object? = dynamic>() → void
|
||||
return <T extends core::Object? = dynamic>() → void {};
|
||||
static method ExtensionSetter|set#call(lowered final core::bool #this, <T extends core::Object? = dynamic>() → void value) → void {}
|
||||
static method Ambiguous1|call<T extends core::Object? = dynamic>(lowered final core::String #this) → dynamic {}
|
||||
static method Ambiguous1|get#call(lowered final core::String #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Ambiguous1|call<T%>(#this);
|
||||
static method Ambiguous2|call<T extends core::Object? = dynamic>(lowered final core::String #this) → dynamic {}
|
||||
static method Ambiguous2|get#call(lowered final core::String #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Ambiguous2|call<T%>(#this);
|
||||
static method main() → dynamic {
|
||||
self::method<self::Class, core::int>(new self::Class::•(), 0, new self::Class::•(), 0);
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
import 'dart:async';
|
||||
|
||||
method<T extends Class, S extends int>(Class c, int i, T t, S s) {}
|
||||
test<T extends Class?, S extends int>(
|
||||
Class? c1,
|
||||
GetterCall c2,
|
||||
int? i,
|
||||
T t1,
|
||||
T? t2,
|
||||
S? s,
|
||||
void Function<T>()? f1,
|
||||
Never n,
|
||||
dynamic d,
|
||||
String a,
|
||||
double b,
|
||||
bool c,
|
||||
FutureOr<Class> f2,
|
||||
Function f3) {}
|
||||
|
||||
class Class {
|
||||
call<T>() {}
|
||||
}
|
||||
|
||||
class GetterCall {
|
||||
void Function<T>() get call => <T>() {};
|
||||
}
|
||||
|
||||
extension Extension on int {
|
||||
call<T>() {}
|
||||
}
|
||||
|
||||
extension ExtensionGetter on double {
|
||||
void Function<T>() get call => <T>() {};
|
||||
}
|
||||
|
||||
extension ExtensionSetter on bool {
|
||||
set call(void Function<T>() value) {}
|
||||
}
|
||||
|
||||
extension Ambiguous1 on String {
|
||||
call<T>() {}
|
||||
}
|
||||
|
||||
extension Ambiguous2 on String {
|
||||
call<T>() {}
|
||||
}
|
||||
|
||||
main() {}
|
|
@ -0,0 +1,47 @@
|
|||
import 'dart:async';
|
||||
|
||||
class Class {
|
||||
call<T>() {}
|
||||
}
|
||||
|
||||
class GetterCall {
|
||||
void Function<T>() get call => <T>() {};
|
||||
}
|
||||
|
||||
extension Ambiguous1 on String {
|
||||
call<T>() {}
|
||||
}
|
||||
|
||||
extension Ambiguous2 on String {
|
||||
call<T>() {}
|
||||
}
|
||||
|
||||
extension Extension on int {
|
||||
call<T>() {}
|
||||
}
|
||||
|
||||
extension ExtensionGetter on double {
|
||||
void Function<T>() get call => <T>() {};
|
||||
}
|
||||
|
||||
extension ExtensionSetter on bool {
|
||||
set call(void Function<T>() value) {}
|
||||
}
|
||||
|
||||
main() {}
|
||||
method<T extends Class, S extends int>(Class c, int i, T t, S s) {}
|
||||
test<T extends Class?, S extends int>(
|
||||
Class? c1,
|
||||
GetterCall c2,
|
||||
int? i,
|
||||
T t1,
|
||||
T? t2,
|
||||
S? s,
|
||||
void Function<T>()? f1,
|
||||
Never n,
|
||||
dynamic d,
|
||||
String a,
|
||||
double b,
|
||||
bool c,
|
||||
FutureOr<Class> f2,
|
||||
Function f3) {}
|
|
@ -0,0 +1,189 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:29:5: 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.
|
||||
// c1<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:30:5: 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.
|
||||
// c2<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:31:4: 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.
|
||||
// i<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:32:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// t1<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:33:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T?'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// t2<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:34:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'S?'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// s<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'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// n<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:37:4: 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.
|
||||
// d<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:38:4: 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.
|
||||
// a<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:39:4: 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.
|
||||
// b<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:40:4: 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.
|
||||
// c<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:41:5: 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.
|
||||
// f2<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:42:5: 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.
|
||||
// f3<int>; // error
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
class Class extends core::Object {
|
||||
synthetic constructor •() → self::Class
|
||||
: super core::Object::•()
|
||||
;
|
||||
method call<T extends core::Object? = dynamic>() → dynamic {}
|
||||
}
|
||||
class GetterCall extends core::Object {
|
||||
synthetic constructor •() → self::GetterCall
|
||||
: super core::Object::•()
|
||||
;
|
||||
get call() → <T extends core::Object? = dynamic>() → void
|
||||
return <T extends core::Object? = dynamic>() → void {};
|
||||
}
|
||||
extension Extension on core::int {
|
||||
method call = self::Extension|call;
|
||||
tearoff call = self::Extension|get#call;
|
||||
}
|
||||
extension ExtensionGetter on core::double {
|
||||
get call = self::ExtensionGetter|get#call;
|
||||
}
|
||||
extension ExtensionSetter on core::bool {
|
||||
set call = self::ExtensionSetter|set#call;
|
||||
}
|
||||
extension Ambiguous1 on core::String {
|
||||
method call = self::Ambiguous1|call;
|
||||
tearoff call = self::Ambiguous1|get#call;
|
||||
}
|
||||
extension Ambiguous2 on core::String {
|
||||
method call = self::Ambiguous2|call;
|
||||
tearoff call = self::Ambiguous2|get#call;
|
||||
}
|
||||
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>;
|
||||
self::Extension|get#call(i)<core::int>;
|
||||
t.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
||||
self::Extension|get#call(s)<core::int>;
|
||||
}
|
||||
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 {
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:29:5: 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.
|
||||
c1<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:30:5: 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.
|
||||
c2<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:31:4: 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.
|
||||
i<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:32:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'.
|
||||
Try changing the operand or remove the type arguments.
|
||||
t1<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:33:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T?'.
|
||||
Try changing the operand or remove the type arguments.
|
||||
t2<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:34:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'S?'.
|
||||
Try changing the operand or remove the type arguments.
|
||||
s<int>; // error
|
||||
^";
|
||||
f1<core::int>;
|
||||
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<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:37:4: 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.
|
||||
d<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:38:4: 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.
|
||||
a<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:39:4: 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.
|
||||
b<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:40:4: 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.
|
||||
c<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:41:5: 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.
|
||||
f2<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:42:5: 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.
|
||||
f3<int>; // error
|
||||
^";
|
||||
}
|
||||
static method Extension|call<T extends core::Object? = dynamic>(lowered final core::int #this) → dynamic {}
|
||||
static method Extension|get#call(lowered final core::int #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Extension|call<T%>(#this);
|
||||
static method ExtensionGetter|get#call(lowered final core::double #this) → <T extends core::Object? = dynamic>() → void
|
||||
return <T extends core::Object? = dynamic>() → void {};
|
||||
static method ExtensionSetter|set#call(lowered final core::bool #this, <T extends core::Object? = dynamic>() → void value) → void {}
|
||||
static method Ambiguous1|call<T extends core::Object? = dynamic>(lowered final core::String #this) → dynamic {}
|
||||
static method Ambiguous1|get#call(lowered final core::String #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Ambiguous1|call<T%>(#this);
|
||||
static method Ambiguous2|call<T extends core::Object? = dynamic>(lowered final core::String #this) → dynamic {}
|
||||
static method Ambiguous2|get#call(lowered final core::String #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Ambiguous2|call<T%>(#this);
|
||||
static method main() → dynamic {
|
||||
self::method<self::Class, core::int>(new self::Class::•(), 0, new self::Class::•(), 0);
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
class Class extends core::Object {
|
||||
synthetic constructor •() → self::Class
|
||||
;
|
||||
method call<T extends core::Object? = dynamic>() → dynamic
|
||||
;
|
||||
}
|
||||
class GetterCall extends core::Object {
|
||||
synthetic constructor •() → self::GetterCall
|
||||
;
|
||||
get call() → <T extends core::Object? = dynamic>() → void
|
||||
;
|
||||
}
|
||||
extension Extension on core::int {
|
||||
method call = self::Extension|call;
|
||||
tearoff call = self::Extension|get#call;
|
||||
}
|
||||
extension ExtensionGetter on core::double {
|
||||
get call = self::ExtensionGetter|get#call;
|
||||
}
|
||||
extension ExtensionSetter on core::bool {
|
||||
set call = self::ExtensionSetter|set#call;
|
||||
}
|
||||
extension Ambiguous1 on core::String {
|
||||
method call = self::Ambiguous1|call;
|
||||
tearoff call = self::Ambiguous1|get#call;
|
||||
}
|
||||
extension Ambiguous2 on core::String {
|
||||
method call = self::Ambiguous2|call;
|
||||
tearoff call = self::Ambiguous2|get#call;
|
||||
}
|
||||
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 Extension|call<T extends core::Object? = dynamic>(lowered final core::int #this) → dynamic
|
||||
;
|
||||
static method Extension|get#call(lowered final core::int #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Extension|call<T%>(#this);
|
||||
static method ExtensionGetter|get#call(lowered final core::double #this) → <T extends core::Object? = dynamic>() → void
|
||||
;
|
||||
static method ExtensionSetter|set#call(lowered final core::bool #this, <T extends core::Object? = dynamic>() → void value) → void
|
||||
;
|
||||
static method Ambiguous1|call<T extends core::Object? = dynamic>(lowered final core::String #this) → dynamic
|
||||
;
|
||||
static method Ambiguous1|get#call(lowered final core::String #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Ambiguous1|call<T%>(#this);
|
||||
static method Ambiguous2|call<T extends core::Object? = dynamic>(lowered final core::String #this) → dynamic
|
||||
;
|
||||
static method Ambiguous2|get#call(lowered final core::String #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Ambiguous2|call<T%>(#this);
|
||||
static method main() → dynamic
|
||||
;
|
|
@ -0,0 +1,189 @@
|
|||
library /*isNonNullableByDefault*/;
|
||||
//
|
||||
// Problems in library:
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:29:5: 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.
|
||||
// c1<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:30:5: 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.
|
||||
// c2<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:31:4: 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.
|
||||
// i<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:32:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// t1<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:33:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T?'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// t2<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:34:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'S?'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// s<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'.
|
||||
// Try changing the operand or remove the type arguments.
|
||||
// n<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:37:4: 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.
|
||||
// d<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:38:4: 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.
|
||||
// a<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:39:4: 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.
|
||||
// b<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:40:4: 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.
|
||||
// c<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:41:5: 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.
|
||||
// f2<int>; // error
|
||||
// ^
|
||||
//
|
||||
// pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:42:5: 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.
|
||||
// f3<int>; // error
|
||||
// ^
|
||||
//
|
||||
import self as self;
|
||||
import "dart:core" as core;
|
||||
|
||||
import "dart:async";
|
||||
|
||||
class Class extends core::Object {
|
||||
synthetic constructor •() → self::Class
|
||||
: super core::Object::•()
|
||||
;
|
||||
method call<T extends core::Object? = dynamic>() → dynamic {}
|
||||
}
|
||||
class GetterCall extends core::Object {
|
||||
synthetic constructor •() → self::GetterCall
|
||||
: super core::Object::•()
|
||||
;
|
||||
get call() → <T extends core::Object? = dynamic>() → void
|
||||
return <T extends core::Object? = dynamic>() → void {};
|
||||
}
|
||||
extension Extension on core::int {
|
||||
method call = self::Extension|call;
|
||||
tearoff call = self::Extension|get#call;
|
||||
}
|
||||
extension ExtensionGetter on core::double {
|
||||
get call = self::ExtensionGetter|get#call;
|
||||
}
|
||||
extension ExtensionSetter on core::bool {
|
||||
set call = self::ExtensionSetter|set#call;
|
||||
}
|
||||
extension Ambiguous1 on core::String {
|
||||
method call = self::Ambiguous1|call;
|
||||
tearoff call = self::Ambiguous1|get#call;
|
||||
}
|
||||
extension Ambiguous2 on core::String {
|
||||
method call = self::Ambiguous2|call;
|
||||
tearoff call = self::Ambiguous2|get#call;
|
||||
}
|
||||
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>;
|
||||
self::Extension|get#call(i)<core::int>;
|
||||
t.{self::Class::call}{<T extends core::Object? = dynamic>() → dynamic}<core::int>;
|
||||
self::Extension|get#call(s)<core::int>;
|
||||
}
|
||||
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 {
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:29:5: 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.
|
||||
c1<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:30:5: 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.
|
||||
c2<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:31:4: 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.
|
||||
i<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:32:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T'.
|
||||
Try changing the operand or remove the type arguments.
|
||||
t1<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:33:5: Error: The static type of the explicit instantiation operand must be a generic function type but is 'T?'.
|
||||
Try changing the operand or remove the type arguments.
|
||||
t2<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:34:4: Error: The static type of the explicit instantiation operand must be a generic function type but is 'S?'.
|
||||
Try changing the operand or remove the type arguments.
|
||||
s<int>; // error
|
||||
^";
|
||||
f1<core::int>;
|
||||
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<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:37:4: 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.
|
||||
d<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:38:4: 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.
|
||||
a<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:39:4: 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.
|
||||
b<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:40:4: 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.
|
||||
c<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:41:5: 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.
|
||||
f2<int>; // error
|
||||
^";
|
||||
invalid-expression "pkg/front_end/testcases/constructor_tearoffs/callable_instantiation.dart:42:5: 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.
|
||||
f3<int>; // error
|
||||
^";
|
||||
}
|
||||
static method Extension|call<T extends core::Object? = dynamic>(lowered final core::int #this) → dynamic {}
|
||||
static method Extension|get#call(lowered final core::int #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Extension|call<T%>(#this);
|
||||
static method ExtensionGetter|get#call(lowered final core::double #this) → <T extends core::Object? = dynamic>() → void
|
||||
return <T extends core::Object? = dynamic>() → void {};
|
||||
static method ExtensionSetter|set#call(lowered final core::bool #this, <T extends core::Object? = dynamic>() → void value) → void {}
|
||||
static method Ambiguous1|call<T extends core::Object? = dynamic>(lowered final core::String #this) → dynamic {}
|
||||
static method Ambiguous1|get#call(lowered final core::String #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Ambiguous1|call<T%>(#this);
|
||||
static method Ambiguous2|call<T extends core::Object? = dynamic>(lowered final core::String #this) → dynamic {}
|
||||
static method Ambiguous2|get#call(lowered final core::String #this) → <T extends core::Object? = dynamic>() → dynamic
|
||||
return <T extends core::Object? = dynamic>() → dynamic => self::Ambiguous2|call<T%>(#this);
|
||||
static method main() → dynamic {
|
||||
self::method<self::Class, core::int>(new self::Class::•(), 0, new self::Class::•(), 0);
|
||||
}
|
|
@ -307,9 +307,7 @@ void main() {
|
|||
// Valid only if parenthesized.
|
||||
expect1((Z < X, X >) < 4);
|
||||
|
||||
// Still can't instantiate something non-generic.
|
||||
/**/ v<int>;
|
||||
// ^^^^^
|
||||
// [cfe] The static type of the explicit instantiation operand must be a generic function type but is 'Object?'.
|
||||
// [analyzer] unspecified
|
||||
// Since `v` has type `Object?`, this is an extension invocation of the
|
||||
// implicit `call` tear off.
|
||||
/**/ v<int, String>;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue