Skip to content

Commit 8db129b

Browse files
committed
[ASTPrinter] Print 'any' for existential metatypes when explicit
existential types are enabled.
1 parent 0b29ba9 commit 8db129b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/AST/ASTPrinter.cpp

+6-1
Original file line numberDiff line numberDiff line change
@@ -4739,10 +4739,15 @@ class TypePrinter : public TypeVisitor<TypePrinter> {
47394739
case MetatypeRepresentation::ObjC: Printer << "@objc_metatype "; break;
47404740
}
47414741
}
4742+
4743+
auto &ctx = T->getASTContext();
4744+
if (T->is<ExistentialMetatypeType>() &&
4745+
ctx.LangOpts.EnableExplicitExistentialTypes)
4746+
Printer << "any ";
4747+
47424748
printWithParensIfNotSimple(T->getInstanceType());
47434749

47444750
// We spell normal metatypes of existential types as .Protocol.
4745-
auto &ctx = T->getASTContext();
47464751
if (isa<MetatypeType>(T) &&
47474752
T->getInstanceType()->isAnyExistentialType() &&
47484753
!ctx.LangOpts.EnableExplicitExistentialTypes) {

0 commit comments

Comments
 (0)