Index: sdk/lib/_internal/compiler/implementation/dart_types.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/dart_types.dart b/sdk/lib/_internal/compiler/implementation/dart_types.dart |
index b9bdbd73d903a7da25e4aeba8708a7654d02ec14..c79571b1a23723c948510527c839eeb8e7e82d00 100644 |
--- a/sdk/lib/_internal/compiler/implementation/dart_types.dart |
+++ b/sdk/lib/_internal/compiler/implementation/dart_types.dart |
@@ -75,6 +75,7 @@ abstract class DartType { |
*/ |
bool get isMalformed => false; |
+ bool get containsTypeVariable => false; |
/** |
* Calls [f] with each [MalformedType] within this type. |
* |
@@ -126,6 +127,8 @@ class TypeVariableType extends DartType { |
SourceString get name => element.name; |
+ bool get containsTypeVariable => true; |
+ |
DartType subst(Link<DartType> arguments, Link<DartType> parameters) { |
if (parameters.isEmpty) { |
assert(arguments.isEmpty); |
@@ -299,6 +302,15 @@ abstract class GenericType extends DartType { |
GenericType(Link<DartType> this.typeArguments, bool this.isMalformed); |
+ bool get containsTypeVariable { |
+ for (Link<DartType> arguments = typeArguments; |
+ !arguments.isEmpty; |
+ arguments = arguments.tail) { |
+ if (arguments.head.containsTypeVariable) return true; |
+ } |
+ return false; |
+ } |
+ |
TypeDeclarationElement get element; |
/// Creates a new instance of this type using the provided type arguments. |