Skip to content

Commit 1d8b0f2

Browse files
committed
SILGen: Simplify SILGenModule::useConformance()
1 parent 979fc90 commit 1d8b0f2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/SILGen/SILGenLazyConformance.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,17 +37,18 @@ void SILGenModule::useConformance(ProtocolConformanceRef conformanceRef) {
3737
if (auto *inherited = dyn_cast<InheritedProtocolConformance>(conformance))
3838
conformance = inherited->getInheritedConformance();
3939

40+
// Emit any conformances implied by conditional requirements.
41+
if (auto *specialized = dyn_cast<SpecializedProtocolConformance>(conformance)) {
42+
useConformancesFromSubstitutions(specialized->getSubstitutionMap());
43+
conformance = specialized->getGenericConformance();
44+
}
45+
4046
// Get the normal conformance. If we don't have one, this is a self
4147
// conformance, which we can ignore.
42-
auto normal = dyn_cast<NormalProtocolConformance>(
43-
conformance->getRootConformance());
48+
auto normal = dyn_cast<NormalProtocolConformance>(conformance);
4449
if (normal == nullptr)
4550
return;
4651

47-
// Emit any conformances implied by conditional requirements.
48-
if (auto *specialized = dyn_cast<SpecializedProtocolConformance>(conformance))
49-
useConformancesFromSubstitutions(specialized->getSubstitutionMap());
50-
5152
// If this conformance was not synthesized by the ClangImporter, we're not
5253
// going to be emitting it lazily either, so we can avoid doing anything
5354
// below.

0 commit comments

Comments
 (0)