Skip to content

Commit 48b1f16

Browse files
committed
Simplify code
1 parent e144d0f commit 48b1f16

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

lib/SILOptimizer/SILCombiner/SILCombinerApplyVisitors.cpp

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -705,17 +705,8 @@ SILCombiner::createApplyWithConcreteType(FullApplySite AI,
705705
},
706706
[&](CanType origTy, Type substTy,
707707
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());
719710
}
720711
return ProtocolConformanceRef(proto->getDecl());
721712
});
@@ -807,13 +798,8 @@ getConformanceAndConcreteType(FullApplySite AI,
807798
if (Requirement->inheritsFrom(Protocol)) {
808799
// If Requirement != Protocol, then the abstract conformance cannot be used
809800
// 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);
817803
}
818804
}
819805

0 commit comments

Comments
 (0)