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

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

Issue 47923014: Issue 14364. Strengthen isDirectSupertypeOf() to check type parameters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 months 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 7aa259bed23890e5f8f4010149937eaf0d1d28d9..50a3879c1dc29c0602b6a1441c5f786b4927d514 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,7 @@ public class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType
}
@Override
- public boolean isMoreSpecificThan(Type s) {
+ public boolean isMoreSpecificThan(Type s, boolean withDynamic) {
//
// A type T is more specific than a type S, written T << S, if one of the following conditions
// is met:
@@ -103,12 +103,12 @@ public class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType
return true;
}
- return isMoreSpecificThan(s, new HashSet<Type>());
+ return isMoreSpecificThan(s, new HashSet<Type>(), withDynamic);
}
@Override
public boolean isSubtypeOf(Type s) {
- return isMoreSpecificThan(s);
+ return isMoreSpecificThan(s, true);
}
@Override
@@ -122,7 +122,7 @@ public class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType
return this;
}
- private boolean isMoreSpecificThan(Type s, Set<Type> visitedTypes) {
+ private boolean isMoreSpecificThan(Type s, Set<Type> visitedTypes, boolean withDynamic) {
// T is a type parameter and S is the upper bound of T.
//
Type bound = getElement().getBound();
@@ -152,10 +152,10 @@ public class TypeParameterTypeImpl extends TypeImpl implements TypeParameterType
}
visitedTypes.add(bound);
// Then check upper bound.
- return boundTypeParameter.isMoreSpecificThan(s, visitedTypes);
+ return boundTypeParameter.isMoreSpecificThan(s, visitedTypes, withDynamic);
}
// Check interface type.
- return bound.isMoreSpecificThan(s);
+ return bound.isMoreSpecificThan(s, withDynamic);
}
}

Powered by Google App Engine
This is Rietveld 408576698