Index: pkg/compiler/lib/src/resolution/constructors.dart |
diff --git a/pkg/compiler/lib/src/resolution/constructors.dart b/pkg/compiler/lib/src/resolution/constructors.dart |
index 17bd6e030d29d0abb2d2515352645776a7dba8ce..7a4dbc68af735d296d314058213cbcc0a99162b1 100644 |
--- a/pkg/compiler/lib/src/resolution/constructors.dart |
+++ b/pkg/compiler/lib/src/resolution/constructors.dart |
@@ -719,7 +719,17 @@ class ConstructorResolver extends CommonResolverVisitor<ConstructorResult> { |
ConstructorResult constructorResultForType(Node node, DartType type, |
{PrefixElement prefix}) { |
String name = type.name; |
- if (type.isMalformed) { |
+ if (type.isTypeVariable) { |
+ return reportAndCreateErroneousConstructorElement( |
+ node, |
+ ConstructorResultKind.INVALID_TYPE, |
+ type, |
+ resolver.enclosingElement, |
+ name, |
+ MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, |
+ {'typeVariableName': name}); |
+ } else if (type.isMalformed) { |
+ // `type is MalformedType`: `MethodTypeVariableType` is handled above. |
return new ConstructorResult.forError( |
ConstructorResultKind.INVALID_TYPE, type.element, type); |
} else if (type.isInterfaceType) { |
@@ -733,15 +743,6 @@ class ConstructorResolver extends CommonResolverVisitor<ConstructorResult> { |
name, |
MessageKind.CANNOT_INSTANTIATE_TYPEDEF, |
{'typedefName': name}); |
- } else if (type.isTypeVariable) { |
- return reportAndCreateErroneousConstructorElement( |
- node, |
- ConstructorResultKind.INVALID_TYPE, |
- type, |
- resolver.enclosingElement, |
- name, |
- MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, |
- {'typeVariableName': name}); |
} |
return reporter.internalError(node, "Unexpected constructor type $type"); |
} |