@@ -795,12 +795,23 @@ getConformanceAndConcreteType(FullApplySite AI,
795
795
if (Requirement == Protocol) {
796
796
return std::make_tuple (Conformance, ConcreteType, ConcreteTypeDef);
797
797
}
798
- if (Requirement->inheritsFrom (Protocol)) {
799
- // If Requirement != Protocol, then the abstract conformance cannot be used
800
- // as is and we need to create a proper conformance.
801
- return std::make_tuple (Conformance.getInherited (Protocol), ConcreteType,
802
- ConcreteTypeDef);
803
- }
798
+ // If Requirement != Protocol, then the abstract conformance cannot be
799
+ // used as is and we need to create a proper conformance.
800
+ // FIXME: We can handle only direct inheritance at the moment due to some
801
+ // limitations of the init_existential_* instructions representation.
802
+ // Once these instructions start using generic signatures instead of
803
+ // conformances lists, it should be fairly easy to support the indirect
804
+ // inheritance here by something like:
805
+ // Substitution Sub(ConcreteType, Conformances);
806
+ // IE->getGenericSignature()
807
+ // ->getSubstitutionMap({Sub}).lookupConformance(GP00, Protocol);
808
+ auto InheritedProtocols = Requirement->getInheritedProtocols ();
809
+ if (std::find (InheritedProtocols.begin (), InheritedProtocols.end (),
810
+ Protocol) == InheritedProtocols.end ())
811
+ return None;
812
+ // Requirement is directly inherited from Protocol.
813
+ return std::make_tuple (Conformance.getInherited (Protocol), ConcreteType,
814
+ ConcreteTypeDef);
804
815
}
805
816
806
817
llvm_unreachable (" couldn't find matching conformance in substitution?" );
0 commit comments