Index: runtime/vm/object.cc |
=================================================================== |
--- runtime/vm/object.cc (revision 6603) |
+++ runtime/vm/object.cc (working copy) |
@@ -1535,49 +1535,48 @@ |
other_type_arguments, |
malformed_error); |
} |
- // Check for 'direct super type' in the case of an interface and check for |
- // transitivity at the same time. |
- if (other.is_interface()) { |
- Array& interfaces = Array::Handle(this->interfaces()); |
- AbstractType& interface = AbstractType::Handle(); |
- Class& interface_class = Class::Handle(); |
- AbstractTypeArguments& interface_args = AbstractTypeArguments::Handle(); |
- for (intptr_t i = 0; i < interfaces.Length(); i++) { |
- interface ^= interfaces.At(i); |
- interface_class = interface.type_class(); |
- interface_args = interface.arguments(); |
- if (!interface_args.IsNull() && !interface_args.IsInstantiated()) { |
- // This type class implements an interface that is parameterized with |
- // generic type(s), e.g. it implements List<T>. |
- // The uninstantiated type T must be instantiated using the type |
- // parameters of this type before performing the type test. |
- // The type arguments of this type that are referred to by the type |
- // parameters of the interface are at the end of the type vector, |
- // after the type arguments of the super type of this type. |
- // The index of the type parameters is adjusted upon finalization. |
- ASSERT(interface.IsFinalized()); |
- interface_args = interface_args.InstantiateFrom(type_arguments); |
- // In checked mode, verify that the instantiated interface type |
- // arguments are within the bounds specified by the interface class. |
- // Note that the additional bounds check in checked mode may lead to a |
- // dynamic type error, but it will never change the result of the type |
- // check from true in production mode to false in checked mode. |
- if (FLAG_enable_type_checks && !interface_args.IsNull()) { |
- // Pass type_arguments as bounds instantiator. |
- if (!interface_args.IsWithinBoundsOf(interface_class, |
- type_arguments, |
- malformed_error)) { |
- continue; |
- } |
+ // Check for 'direct super type' in the case of an interface |
+ // (i.e. other.is_interface()) or implicit interface (i.e. |
+ // !other.is_interface()) and check for transitivity at the same time. |
+ Array& interfaces = Array::Handle(this->interfaces()); |
+ AbstractType& interface = AbstractType::Handle(); |
+ Class& interface_class = Class::Handle(); |
+ AbstractTypeArguments& interface_args = AbstractTypeArguments::Handle(); |
+ for (intptr_t i = 0; i < interfaces.Length(); i++) { |
+ interface ^= interfaces.At(i); |
+ interface_class = interface.type_class(); |
+ interface_args = interface.arguments(); |
+ if (!interface_args.IsNull() && !interface_args.IsInstantiated()) { |
+ // This type class implements an interface that is parameterized with |
+ // generic type(s), e.g. it implements List<T>. |
+ // The uninstantiated type T must be instantiated using the type |
+ // parameters of this type before performing the type test. |
+ // The type arguments of this type that are referred to by the type |
+ // parameters of the interface are at the end of the type vector, |
+ // after the type arguments of the super type of this type. |
+ // The index of the type parameters is adjusted upon finalization. |
+ ASSERT(interface.IsFinalized()); |
+ interface_args = interface_args.InstantiateFrom(type_arguments); |
+ // In checked mode, verify that the instantiated interface type |
+ // arguments are within the bounds specified by the interface class. |
+ // Note that the additional bounds check in checked mode may lead to a |
+ // dynamic type error, but it will never change the result of the type |
+ // check from true in production mode to false in checked mode. |
+ if (FLAG_enable_type_checks && !interface_args.IsNull()) { |
+ // Pass type_arguments as bounds instantiator. |
+ if (!interface_args.IsWithinBoundsOf(interface_class, |
+ type_arguments, |
+ malformed_error)) { |
+ continue; |
} |
} |
- if (interface_class.IsSubtypeOf(interface_args, |
- other, |
- other_type_arguments, |
- malformed_error)) { |
- return true; |
- } |
} |
+ if (interface_class.IsSubtypeOf(interface_args, |
+ other, |
+ other_type_arguments, |
+ malformed_error)) { |
+ return true; |
+ } |
} |
// Check the interface case. |
if (is_interface()) { |