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

Unified Diff: sdk/lib/_internal/compiler/implementation/dart_types.dart

Issue 12210013: Implement subtype for type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/elements/elements.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8f209240b8ec5101e4b2b1dce44466973471d422..6705302c045ab3e5330f6db4fd94e2f1e2d429b8 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_types.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_types.dart
@@ -122,6 +122,8 @@ class TypeVariableType extends DartType {
TypeVariableType(this.element);
+ DartType get upperBound => element.upperBound;
+
TypeKind get kind => TypeKind.TYPE_VARIABLE;
SourceString get name => element.name;
@@ -788,8 +790,9 @@ class Types {
}
return true;
} else if (t is TypeVariableType) {
- if (s is !TypeVariableType) return false;
- return (identical(t.element, s.element));
+ if (t == s) return true;
+ TypeVariableType typeVariable = t;
+ return isSubtype(typeVariable.upperBound, s);
ahe 2013/02/05 15:14:40 How do you deal with: class Foo<T extends S, S ex
Johnni Winther 2013/02/05 18:45:57 I don't. I think this should be part of the (still
ahe 2013/02/18 08:22:18 I don't like having known unbounded recursion in a
} else {
throw 'internal error: unknown type kind';
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/elements/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698