@@ -913,6 +913,7 @@ class PrintAST : public ASTVisitor<PrintAST> {
913
913
void printSynthesizedExtension (Type ExtendedType, ExtensionDecl *ExtDecl);
914
914
915
915
void printExtension (ExtensionDecl* ExtDecl);
916
+ void printExtendedTypeName (TypeLoc ExtendedTypeLoc);
916
917
917
918
public:
918
919
PrintAST (ASTPrinter &Printer, const PrintOptions &Options)
@@ -2331,8 +2332,7 @@ void PrintAST::visitImportDecl(ImportDecl *decl) {
2331
2332
[&] { Printer << " ." ; });
2332
2333
}
2333
2334
2334
- static void printExtendedTypeName (Type ExtendedType, ASTPrinter &Printer,
2335
- PrintOptions &Options) {
2335
+ void PrintAST::printExtendedTypeName (TypeLoc ExtendedTypeLoc) {
2336
2336
bool OldFullyQualifiedTypesIfAmbiguous =
2337
2337
Options.FullyQualifiedTypesIfAmbiguous ;
2338
2338
Options.FullyQualifiedTypesIfAmbiguous =
@@ -2342,9 +2342,8 @@ static void printExtendedTypeName(Type ExtendedType, ASTPrinter &Printer,
2342
2342
};
2343
2343
2344
2344
// 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));
2348
2347
}
2349
2348
2350
2349
@@ -2402,7 +2401,7 @@ void PrintAST::printSynthesizedExtension(Type ExtendedType,
2402
2401
printAttributes (ExtDecl);
2403
2402
Printer << tok::kw_extension << " " ;
2404
2403
2405
- printExtendedTypeName (ExtendedType, Printer, Options );
2404
+ printExtendedTypeName (TypeLoc::withoutLoc ( ExtendedType) );
2406
2405
printInherited (ExtDecl);
2407
2406
2408
2407
// We may need to combine requirements from ExtDecl (which has the members
@@ -2453,7 +2452,7 @@ void PrintAST::printExtension(ExtensionDecl *decl) {
2453
2452
printTypeLoc (TypeLoc::withoutLoc (extendedType));
2454
2453
return ;
2455
2454
}
2456
- printExtendedTypeName (extendedType, Printer, Options );
2455
+ printExtendedTypeName (TypeLoc (decl-> getExtendedTypeRepr (), extendedType) );
2457
2456
});
2458
2457
printInherited (decl);
2459
2458
0 commit comments