| Index: pkg/analyzer/lib/src/generated/resolver.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
|
| index b80ed5a2deaca94429c70bb7a6759ea33bb33889..e130e583645d952304930ec5c40d6a005cea372f 100644
|
| --- a/pkg/analyzer/lib/src/generated/resolver.dart
|
| +++ b/pkg/analyzer/lib/src/generated/resolver.dart
|
| @@ -14959,7 +14959,7 @@ class TypeResolverVisitor extends ScopedVisitor {
|
| if (argumentList != null) {
|
| NodeList<TypeName> arguments = argumentList.arguments;
|
| int argumentCount = arguments.length;
|
| - List<DartType> parameters = _getTypeArguments(type);
|
| + List<DartType> parameters = _getTypeParameters(type);
|
| int parameterCount = parameters.length;
|
| List<DartType> typeArguments = new List<DartType>(parameterCount);
|
| if (argumentCount == parameterCount) {
|
| @@ -14978,21 +14978,13 @@ class TypeResolverVisitor extends ScopedVisitor {
|
| typeArguments[i] = _dynamicType;
|
| }
|
| }
|
| - if (type is InterfaceTypeImpl) {
|
| - InterfaceTypeImpl interfaceType = type as InterfaceTypeImpl;
|
| - type = interfaceType.substitute4(typeArguments);
|
| - } else if (type is FunctionTypeImpl) {
|
| - FunctionTypeImpl functionType = type as FunctionTypeImpl;
|
| - type = functionType.substitute3(typeArguments);
|
| - } else {
|
| - // TODO(brianwilkerson) Report this internal error.
|
| - }
|
| + type = _instantiateType(type, typeArguments);
|
| } else {
|
| //
|
| // Check for the case where there are no type arguments given for a
|
| // parameterized type.
|
| //
|
| - List<DartType> parameters = _getTypeArguments(type);
|
| + List<DartType> parameters = _getTypeParameters(type);
|
| int parameterCount = parameters.length;
|
| if (parameterCount > 0) {
|
| DynamicTypeImpl dynamicType = DynamicTypeImpl.instance;
|
| @@ -15000,7 +14992,7 @@ class TypeResolverVisitor extends ScopedVisitor {
|
| for (int i = 0; i < parameterCount; i++) {
|
| arguments[i] = dynamicType;
|
| }
|
| - type = type.substitute2(arguments, parameters);
|
| + type = _instantiateType(type, arguments);
|
| }
|
| }
|
| typeName.staticType = type;
|
| @@ -15185,11 +15177,11 @@ class TypeResolverVisitor extends ScopedVisitor {
|
| * @param type the type whole type arguments are to be returned
|
| * @return the type arguments associated with the given type
|
| */
|
| - List<DartType> _getTypeArguments(DartType type) {
|
| + List<DartType> _getTypeParameters(DartType type) {
|
| if (type is InterfaceType) {
|
| return type.typeArguments;
|
| } else if (type is FunctionType) {
|
| - return type.typeArguments;
|
| + return TypeParameterTypeImpl.getTypes(type.boundTypeParameters);
|
| }
|
| return DartType.EMPTY_LIST;
|
| }
|
| @@ -15228,6 +15220,17 @@ class TypeResolverVisitor extends ScopedVisitor {
|
| return type;
|
| }
|
|
|
| + DartType _instantiateType(DartType type, List<DartType> typeArguments) {
|
| + if (type is InterfaceTypeImpl) {
|
| + return type.substitute4(typeArguments);
|
| + } else if (type is FunctionTypeImpl) {
|
| + return type.instantiate(typeArguments);
|
| + } else {
|
| + // TODO(brianwilkerson) Report this internal error.
|
| + return type;
|
| + }
|
| + }
|
| +
|
| /**
|
| * Checks if the given type name is used as the type in an as expression.
|
| *
|
|
|