Skip to content

Commit b94cd94

Browse files
committed
ASTPrinter: Remove usages of AbstractTypeParamDecl::getConformedProtocols()
1 parent 7848b4f commit b94cd94

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6559,16 +6559,13 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
65596559

65606560
// Print based on the type.
65616561
Printer << "some ";
6562-
if (!decl->getConformingProtocols().empty()) {
6563-
llvm::interleave(decl->getConformingProtocols(), Printer, [&](ProtocolDecl *proto){
6564-
if (auto printType = proto->getDeclaredType())
6565-
printType->print(Printer, Options);
6566-
else
6567-
Printer << proto->getNameStr();
6568-
}, " & ");
6569-
} else {
6570-
Printer << "Any";
6571-
}
6562+
auto archetypeType = decl->getDeclContext()->mapTypeIntoContext(
6563+
decl->getDeclaredInterfaceType())->castTo<ArchetypeType>();
6564+
auto constraintType = archetypeType->getExistentialType();
6565+
if (auto *existentialType = constraintType->getAs<ExistentialType>())
6566+
constraintType = existentialType->getConstraintType();
6567+
6568+
constraintType->print(Printer, Options);
65726569
return;
65736570
}
65746571

0 commit comments

Comments
 (0)