Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Unified Diff: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/type/TypeParameterTypeImpl.java

Issue 62523002: Fix for 11987. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/type/TypeParameterTypeImpl.java
diff --git a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/type/TypeParameterTypeImpl.java b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/type/TypeParameterTypeImpl.java
index 50a3879c1dc29c0602b6a1441c5f786b4927d514..8c29f315db8b2aee13a3a66bb6e3c973e4e53c57 100644
--- a/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/type/TypeParameterTypeImpl.java
+++ b/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/type/TypeParameterTypeImpl.java
@@ -80,7 +80,19 @@ public class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType
}
@Override
- public boolean isMoreSpecificThan(Type s, boolean withDynamic) {
+ public Type substitute(Type[] argumentTypes, Type[] parameterTypes) {
+ int length = parameterTypes.length;
+ for (int i = 0; i < length; i++) {
+ if (parameterTypes[i].equals(this)) {
+ return argumentTypes[i];
+ }
+ }
+ return this;
+ }
+
+ @Override
+ protected boolean internalIsMoreSpecificThan(Type s, boolean withDynamic,
+ Set<TypePair> visitedTypePairs) {
//
// A type T is more specific than a type S, written T << S, if one of the following conditions
// is met:
@@ -103,26 +115,16 @@ public class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType
return true;
}
- return isMoreSpecificThan(s, new HashSet<Type>(), withDynamic);
+ return isMoreSpecificThan(s, new HashSet<Type>(), withDynamic, visitedTypePairs);
}
@Override
- public boolean isSubtypeOf(Type s) {
- return isMoreSpecificThan(s, true);
- }
-
- @Override
- public Type substitute(Type[] argumentTypes, Type[] parameterTypes) {
- int length = parameterTypes.length;
- for (int i = 0; i < length; i++) {
- if (parameterTypes[i].equals(this)) {
- return argumentTypes[i];
- }
- }
- return this;
+ protected boolean internalIsSubtypeOf(Type type, Set<TypePair> visitedTypePairs) {
+ return isMoreSpecificThan(type, true, new HashSet<TypePair>());
}
- private boolean isMoreSpecificThan(Type s, Set<Type> visitedTypes, boolean withDynamic) {
+ private boolean isMoreSpecificThan(Type s, Set<Type> visitedTypes, boolean withDynamic,
+ Set<TypePair> visitedTypePairs) {
// T is a type parameter and S is the upper bound of T.
//
Type bound = getElement().getBound();
@@ -152,10 +154,10 @@ public class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType
}
visitedTypes.add(bound);
// Then check upper bound.
- return boundTypeParameter.isMoreSpecificThan(s, visitedTypes, withDynamic);
+ return boundTypeParameter.isMoreSpecificThan(s, visitedTypes, withDynamic, visitedTypePairs);
}
// Check interface type.
- return bound.isMoreSpecificThan(s, withDynamic);
+ return bound.isMoreSpecificThan(s, withDynamic, visitedTypePairs);
}
}

Powered by Google App Engine
This is Rietveld 408576698