@@ -913,6 +913,7 @@ class PrintAST : public ASTVisitor<PrintAST> {
913913 void printSynthesizedExtension (Type ExtendedType, ExtensionDecl *ExtDecl);
914914
915915 void printExtension (ExtensionDecl* ExtDecl);
916+ void printExtendedTypeName (TypeLoc ExtendedTypeLoc);
916917
917918public:
918919 PrintAST (ASTPrinter &Printer, const PrintOptions &Options)
@@ -2331,8 +2332,7 @@ void PrintAST::visitImportDecl(ImportDecl *decl) {
23312332 [&] { Printer << " ." ; });
23322333}
23332334
2334- static void printExtendedTypeName (Type ExtendedType, ASTPrinter &Printer,
2335- PrintOptions &Options) {
2335+ void PrintAST::printExtendedTypeName (TypeLoc ExtendedTypeLoc) {
23362336 bool OldFullyQualifiedTypesIfAmbiguous =
23372337 Options.FullyQualifiedTypesIfAmbiguous ;
23382338 Options.FullyQualifiedTypesIfAmbiguous =
@@ -2342,9 +2342,8 @@ static void printExtendedTypeName(Type ExtendedType, ASTPrinter &Printer,
23422342 };
23432343
23442344 // Strip off generic arguments, if any.
2345- auto Ty = ExtendedType->getAnyNominal ()->getDeclaredType ();
2346-
2347- Ty->print (Printer, Options);
2345+ auto Ty = ExtendedTypeLoc.getType ()->getAnyNominal ()->getDeclaredType ();
2346+ printTypeLoc (TypeLoc (ExtendedTypeLoc.getTypeRepr (), Ty));
23482347}
23492348
23502349
@@ -2402,7 +2401,7 @@ void PrintAST::printSynthesizedExtension(Type ExtendedType,
24022401 printAttributes (ExtDecl);
24032402 Printer << tok::kw_extension << " " ;
24042403
2405- printExtendedTypeName (ExtendedType, Printer, Options );
2404+ printExtendedTypeName (TypeLoc::withoutLoc ( ExtendedType) );
24062405 printInherited (ExtDecl);
24072406
24082407 // We may need to combine requirements from ExtDecl (which has the members
@@ -2453,7 +2452,7 @@ void PrintAST::printExtension(ExtensionDecl *decl) {
24532452 printTypeLoc (TypeLoc::withoutLoc (extendedType));
24542453 return ;
24552454 }
2456- printExtendedTypeName (extendedType, Printer, Options );
2455+ printExtendedTypeName (TypeLoc (decl-> getExtendedTypeRepr (), extendedType) );
24572456 });
24582457 printInherited (decl);
24592458
0 commit comments