@@ -705,17 +705,8 @@ SILCombiner::createApplyWithConcreteType(FullApplySite AI,
705
705
},
706
706
[&](CanType origTy, Type substTy,
707
707
ProtocolType *proto) -> Optional<ProtocolConformanceRef> {
708
- if (substTy->getCanonicalType () == ConcreteType) {
709
- if (proto->getDecl () != Conformance.getRequirement ()) {
710
- assert (
711
- Conformance.getRequirement ()->inheritsFrom (proto->getDecl ()));
712
- if (Conformance.isAbstract ())
713
- return ProtocolConformanceRef (proto->getDecl ());
714
- Conformance = ProtocolConformanceRef (
715
- Conformance.getConcrete ()->getInheritedConformance (
716
- proto->getDecl ()));
717
- }
718
- return Conformance;
708
+ if (substTy->isEqual (ConcreteType)) {
709
+ return Conformance.getInherited (proto->getDecl ());
719
710
}
720
711
return ProtocolConformanceRef (proto->getDecl ());
721
712
});
@@ -807,13 +798,8 @@ getConformanceAndConcreteType(FullApplySite AI,
807
798
if (Requirement->inheritsFrom (Protocol)) {
808
799
// If Requirement != Protocol, then the abstract conformance cannot be used
809
800
// as is and we need to create a proper conformance.
810
- return std::make_tuple (
811
- Conformance.isAbstract ()
812
- ? ProtocolConformanceRef (Protocol)
813
- : ProtocolConformanceRef (
814
- Conformance.getConcrete ()->getInheritedConformance (
815
- Protocol)),
816
- ConcreteType, ConcreteTypeDef);
801
+ return std::make_tuple (Conformance.getInherited (Protocol), ConcreteType,
802
+ ConcreteTypeDef);
817
803
}
818
804
}
819
805
0 commit comments