Skip to content

Commit 1b2252f

Browse files
committed
Sema: Update TypeChecker::checkInheritanceClause() for subclass existentials
1 parent 2e5b3b6 commit 1b2252f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/Sema/TypeCheckDecl.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "swift/AST/ASTPrinter.h"
2525
#include "swift/AST/ASTVisitor.h"
2626
#include "swift/AST/ASTWalker.h"
27+
#include "swift/AST/ExistentialLayout.h"
2728
#include "swift/AST/Expr.h"
2829
#include "swift/AST/ForeignErrorConvention.h"
2930
#include "swift/AST/GenericEnvironment.h"
@@ -442,10 +443,11 @@ void TypeChecker::checkInheritanceClause(Decl *decl,
442443
// If this is a protocol or protocol composition type, record the
443444
// protocols.
444445
if (inheritedTy->isExistentialType()) {
445-
SmallVector<ProtocolDecl *, 4> protocols;
446-
inheritedTy->getExistentialTypeProtocols(protocols);
447-
448-
allProtocols.insert(protocols.begin(), protocols.end());
446+
auto layout = inheritedTy->getExistentialLayout();
447+
for (auto proto : layout.getProtocols()) {
448+
auto *protoDecl = proto->getDecl();
449+
allProtocols.insert(protoDecl);
450+
}
449451
continue;
450452
}
451453

0 commit comments

Comments
 (0)