Skip to content

Commit 816f3e6

Browse files
committed
AST: Re-implement ProtocolType::canonicalizeProtocols() to use getAllInheritedProtocols()
1 parent 0e31d41 commit 816f3e6

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

lib/AST/Type.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1533,22 +1533,18 @@ static void canonicalizeProtocols(SmallVectorImpl<ProtocolDecl *> &protocols,
15331533
continue;
15341534

15351535
// Add the protocols we inherited.
1536-
proto->walkInheritedProtocols([&](ProtocolDecl *inherited) {
1537-
if (inherited == proto)
1538-
return TypeWalker::Action::Continue;
1539-
1536+
auto allInherited = proto->getAllInheritedProtocols();
1537+
for (auto *inherited : allInherited) {
15401538
auto found = known.find(inherited);
15411539
if (found != known.end()) {
15421540
// Don't zap protocols associated with parameterized types.
15431541
if (parameterized && parameterized->count(inherited))
1544-
return TypeWalker::Action::Continue;
1542+
return;
15451543

15461544
protocols[found->second] = nullptr;
15471545
zappedAny = true;
15481546
}
1549-
1550-
return TypeWalker::Action::Continue;
1551-
});
1547+
}
15521548
}
15531549

15541550
if (zappedAny) {

0 commit comments

Comments
 (0)