| Index: pkg/analyzer/lib/src/generated/element_resolver.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/element_resolver.dart b/pkg/analyzer/lib/src/generated/element_resolver.dart
|
| index d1189e204298c58be9c873636daa9f2fed2a75af..b018994ca3b91009c4640aad8d62f7cf5bb7644c 100644
|
| --- a/pkg/analyzer/lib/src/generated/element_resolver.dart
|
| +++ b/pkg/analyzer/lib/src/generated/element_resolver.dart
|
| @@ -1352,6 +1352,49 @@ class ElementResolver extends SimpleAstVisitor<Object> {
|
| return null;
|
| }
|
|
|
| + DartType _computeMethodInvokeType(MethodInvocation node, Element element) {
|
| + if (element == null) {
|
| + return null;
|
| + }
|
| +
|
| + DartType invokeType;
|
| + if (element is PropertyAccessorElement) {
|
| + invokeType = element.returnType;
|
| + } else if (element is ExecutableElement) {
|
| + invokeType = element.type;
|
| + } else if (element is VariableElement) {
|
| + invokeType = _promoteManager.getStaticType(element);
|
| + }
|
| +
|
| + //
|
| + // Check for a generic method & apply type arguments if any were passed.
|
| + //
|
| + // TODO(jmesserly): support generic "call" methods on InterfaceType.
|
| + if (invokeType is FunctionType) {
|
| + FunctionType type = invokeType;
|
| + List<TypeParameterElement> parameters = type.typeFormals;
|
| +
|
| + NodeList<TypeName> arguments = node.typeArguments?.arguments;
|
| + if (arguments != null && arguments.length != parameters.length) {
|
| + // Wrong number of type arguments. Ignore them
|
| + arguments = null;
|
| + _resolver.reportErrorForNode(
|
| + StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS,
|
| + node.methodName,
|
| + [type, parameters.length, arguments?.length ?? 0]);
|
| + }
|
| + if (parameters.isNotEmpty) {
|
| + if (arguments == null) {
|
| + invokeType = _resolver.typeSystem.instantiateToBounds(type);
|
| + } else {
|
| + invokeType = type.instantiate(arguments.map((n) => n.type).toList());
|
| + }
|
| + }
|
| + }
|
| +
|
| + return invokeType;
|
| + }
|
| +
|
| /**
|
| * Given an element, computes the type of the invocation.
|
| *
|
| @@ -2573,7 +2616,7 @@ class ElementResolver extends SimpleAstVisitor<Object> {
|
| * AST when the parser could not distinguish between a method invocation and an
|
| * invocation of a top-level function imported with a prefix.
|
| */
|
| -class SyntheticIdentifier extends Identifier {
|
| +class SyntheticIdentifier extends IdentifierImpl {
|
| /**
|
| * The name of the synthetic identifier.
|
| */
|
|
|