| Index: compiler/java/com/google/dart/compiler/resolver/Resolver.java
|
| diff --git a/compiler/java/com/google/dart/compiler/resolver/Resolver.java b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
|
| index c2dc5ac5801446f873fd7960e82b140a898476a1..34dc319f31b878f4b088404db256c5ee4ae657c1 100644
|
| --- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
|
| +++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
|
| @@ -1314,11 +1314,23 @@ public class Resolver {
|
| // try to lookup the constructor in the default class.
|
| constructor = resolveInterfaceConstructorInDefaultClass(x.getConstructor(), constructor);
|
|
|
| - // Check for using "const" to non-const constructor.
|
| + // Check constructor.
|
| if (constructor != null) {
|
| - if (x.isConst() && !constructor.getModifiers().isConstant()) {
|
| + boolean constConstructor = constructor.getModifiers().isConstant();
|
| + // Check for using "const" to non-const constructor.
|
| + if (x.isConst() && !constConstructor) {
|
| onError(x, ResolverErrorCode.CONST_AND_NONCONST_CONSTRUCTOR);
|
| }
|
| + // Check for using "const" with type variables as type arguments.
|
| + if (x.isConst() && constConstructor) {
|
| + DartTypeNode typeNode = Types.constructorTypeNode(x);
|
| + List<DartTypeNode> typeArguments = typeNode.getTypeArguments();
|
| + for (DartTypeNode typeArgument : typeArguments) {
|
| + if (typeArgument.getType() instanceof TypeVariable) {
|
| + onError(typeArgument, ResolverErrorCode.CONST_WITH_TYPE_VARIABLE);
|
| + }
|
| + }
|
| + }
|
| }
|
|
|
| return recordElement(x, constructor);
|
|
|