| Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| index a9e6de9b79957a2c59d2bc0aadb2ad131506d582..8c42f45ba792bdd5a8467de0a012eb927488400f 100644
|
| --- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| +++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/verifier/ErrorVerifier.java
|
| @@ -4018,11 +4018,17 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| Type boundType = boundingElts[i].getBound();
|
| if (argType != null && boundType != null) {
|
| if (!argType.isSubtypeOf(boundType)) {
|
| + ErrorCode errorCode;
|
| + if (isInConstConstructorInvocation(node)) {
|
| + errorCode = CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS;
|
| + } else {
|
| + errorCode = StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS;
|
| + }
|
| errorReporter.reportError(
|
| - StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
|
| + errorCode,
|
| argTypeName,
|
| argTypeName.getName(),
|
| - boundingElts[i].getBound().getDisplayName());
|
| + boundType.getDisplayName());
|
| foundError = true;
|
| }
|
| }
|
| @@ -4295,6 +4301,18 @@ public class ErrorVerifier extends RecursiveASTVisitor<Void> {
|
| }
|
|
|
| /**
|
| + * @return {@code true} if the given {@link ASTNode} is the part of constant constructor
|
| + * invocation.
|
| + */
|
| + private boolean isInConstConstructorInvocation(ASTNode node) {
|
| + InstanceCreationExpression creation = node.getAncestor(InstanceCreationExpression.class);
|
| + if (creation == null) {
|
| + return false;
|
| + }
|
| + return creation.isConst();
|
| + }
|
| +
|
| + /**
|
| * @param node the 'this' expression to analyze
|
| * @return {@code true} if the given 'this' expression is in the valid context
|
| */
|
|
|