Skip to content

Commit 10f0d27

Browse files
committed
AST: Collapse multiple levels of inherited conformance
1 parent db7d1e7 commit 10f0d27

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/AST/ASTContext.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2456,6 +2456,14 @@ ASTContext::getSpecializedConformance(Type type,
24562456

24572457
InheritedProtocolConformance *
24582458
ASTContext::getInheritedConformance(Type type, ProtocolConformance *inherited) {
2459+
// Collapse multiple levels of inherited conformance.
2460+
while (auto *otherInherited = dyn_cast<InheritedProtocolConformance>(inherited))
2461+
inherited = otherInherited->getInheritedConformance();
2462+
2463+
assert(isa<SpecializedProtocolConformance>(inherited) ||
2464+
isa<NormalProtocolConformance>(inherited) ||
2465+
isa<BuiltinProtocolConformance>(inherited));
2466+
24592467
llvm::FoldingSetNodeID id;
24602468
InheritedProtocolConformance::Profile(id, type, inherited);
24612469

0 commit comments

Comments
 (0)