Index: pkg/compiler/lib/src/elements/types.dart |
diff --git a/pkg/compiler/lib/src/elements/types.dart b/pkg/compiler/lib/src/elements/types.dart |
index d3f68833485e7a8b3d9b3bff99b7d8632f8d7edf..f169ef21f0e43b360f7e1573e7c8f30377859aaf 100644 |
--- a/pkg/compiler/lib/src/elements/types.dart |
+++ b/pkg/compiler/lib/src/elements/types.dart |
@@ -59,6 +59,9 @@ abstract class DartType { |
/// Is `true` if this type is a malformed type. |
bool get isMalformed => false; |
+ |
+ /// Whether this type contains a type variable. |
+ bool get containsTypeVariables => false; |
} |
class InterfaceType extends DartType { |
@@ -67,6 +70,9 @@ class InterfaceType extends DartType { |
InterfaceType(this.element, this.typeArguments); |
+ bool get containsTypeVariables => |
+ typeArguments.any((type) => type.containsTypeVariables); |
+ |
int get hashCode { |
int hash = element.hashCode; |
for (DartType argument in typeArguments) { |
@@ -108,6 +114,8 @@ class TypeVariableType extends DartType { |
bool get isTypeVariable => true; |
+ bool get containsTypeVariables => true; |
+ |
int get hashCode => 17 * element.hashCode; |
bool operator ==(other) { |
@@ -161,6 +169,13 @@ class FunctionType extends DartType { |
this.namedParameters, |
this.namedParameterTypes); |
+ bool get containsTypeVariables { |
+ return returnType.containsTypeVariables || |
+ parameterTypes.any((type) => type.containsTypeVariables) || |
+ optionalParameterTypes.any((type) => type.containsTypeVariables) || |
+ namedParameterTypes.any((type) => type.containsTypeVariables); |
+ } |
+ |
bool get isFunctionType => true; |
int get hashCode { |