| Index: pkg/analyzer/lib/src/generated/error_verifier.dart
|
| diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
|
| index 29c6308dac3fbb3c120dfaf25ecfd290fbd31f8e..537ca319a7e01defc5dba2f7ad6957230b5fede6 100644
|
| --- a/pkg/analyzer/lib/src/generated/error_verifier.dart
|
| +++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
|
| @@ -5225,45 +5225,38 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
|
| if (type == null) {
|
| return;
|
| }
|
| - // prepare type parameters
|
| - List<DartType> typeParameters = null;
|
| - List<TypeParameterElement> boundingElts = null;
|
| - List<DartType> typeArguments = null;
|
| Element element = type.element;
|
| - if (element is ClassElement) {
|
| - typeParameters = element.type.typeArguments;
|
| - boundingElts = element.typeParameters;
|
| - typeArguments = (type as InterfaceType).typeArguments;
|
| - } else if (element is FunctionTypeAliasElement) {
|
| - typeParameters = element.type.typeArguments;
|
| - boundingElts = element.typeParameters;
|
| - typeArguments = (type as FunctionType).typeArguments;
|
| - } else {
|
| - return;
|
| - }
|
| - // iterate over each bounded type parameter and corresponding argument
|
| - NodeList<TypeName> typeNameArgList = typeName.typeArguments.arguments;
|
| - int loopThroughIndex =
|
| - math.min(typeNameArgList.length, boundingElts.length);
|
| - bool shouldSubstitute = typeArguments.length != 0 &&
|
| - typeArguments.length == typeParameters.length;
|
| - for (int i = 0; i < loopThroughIndex; i++) {
|
| - TypeName argTypeName = typeNameArgList[i];
|
| - DartType argType = argTypeName.type;
|
| - DartType boundType = boundingElts[i].bound;
|
| - if (argType != null && boundType != null) {
|
| - if (shouldSubstitute) {
|
| - boundType = boundType.substitute2(typeArguments, typeParameters);
|
| - }
|
| - if (!_typeSystem.isSubtypeOf(argType, boundType)) {
|
| - ErrorCode errorCode;
|
| - if (_isInConstInstanceCreation) {
|
| - errorCode = CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS;
|
| - } else {
|
| - errorCode = StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS;
|
| + if (element is TypeParameterizedElement) {
|
| + // prepare type parameters
|
| + List<TypeParameterElement> parameterElements = element.typeParameters;
|
| + List<DartType> parameterTypes = element.type.typeArguments;
|
| + List<DartType> arguments = (type as ParameterizedType).typeArguments;
|
| + // iterate over each bounded type parameter and corresponding argument
|
| + NodeList<TypeName> typeNameArgList = typeName.typeArguments.arguments;
|
| + int loopThroughIndex =
|
| + math.min(typeNameArgList.length, parameterElements.length);
|
| + bool shouldSubstitute = arguments.length != 0 &&
|
| + arguments.length == parameterTypes.length;
|
| + for (int i = 0; i < loopThroughIndex; i++) {
|
| + TypeName argTypeName = typeNameArgList[i];
|
| + DartType argType = argTypeName.type;
|
| + DartType boundType = parameterElements[i].bound;
|
| + if (argType != null && boundType != null) {
|
| + if (shouldSubstitute) {
|
| + boundType = boundType.substitute2(arguments, parameterTypes);
|
| + }
|
| + if (!_typeSystem.isSubtypeOf(argType, boundType)) {
|
| + ErrorCode errorCode;
|
| + if (_isInConstInstanceCreation) {
|
| + errorCode =
|
| + CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS;
|
| + } else {
|
| + errorCode =
|
| + StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS;
|
| + }
|
| + _errorReporter.reportTypeErrorForNode(
|
| + errorCode, argTypeName, [argType, boundType]);
|
| }
|
| - _errorReporter.reportTypeErrorForNode(
|
| - errorCode, argTypeName, [argType, boundType]);
|
| }
|
| }
|
| }
|
|
|