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 5a270e91213d4825f62daca7414496f62a58a75a..896d8316a7431af3e9a932f9612935e2d62cdb6b 100644 |
--- a/sdk/lib/_internal/compiler/implementation/dart_types.dart |
+++ b/sdk/lib/_internal/compiler/implementation/dart_types.dart |
@@ -485,14 +485,12 @@ class InterfaceType extends GenericType { |
DartType asInstanceOf(ClassElement other) { |
other = other.declaration; |
if (element == other) return this; |
- for (InterfaceType supertype in element.allSupertypes) { |
- ClassElement superclass = supertype.element; |
- if (superclass == other) { |
- Link<DartType> arguments = Types.substTypes(supertype.typeArguments, |
- typeArguments, |
- element.typeVariables); |
- return new InterfaceType(superclass, arguments); |
- } |
+ InterfaceType supertype = element.asInstanceOf(other); |
+ if (supertype != null) { |
+ Link<DartType> arguments = Types.substTypes(supertype.typeArguments, |
+ typeArguments, |
+ element.typeVariables); |
+ return new InterfaceType(supertype.element, arguments); |
} |
return null; |
} |