@@ -919,6 +919,7 @@ class PrintAST : public ASTVisitor<PrintAST> {
919
919
void printSynthesizedExtension (Type ExtendedType, ExtensionDecl *ExtDecl);
920
920
921
921
void printExtension (ExtensionDecl* ExtDecl);
922
+ void printExtendedTypeName (TypeLoc ExtendedTypeLoc);
922
923
923
924
public:
924
925
PrintAST (ASTPrinter &Printer, const PrintOptions &Options)
@@ -2337,8 +2338,7 @@ void PrintAST::visitImportDecl(ImportDecl *decl) {
2337
2338
[&] { Printer << " ." ; });
2338
2339
}
2339
2340
2340
- static void printExtendedTypeName (Type ExtendedType, ASTPrinter &Printer,
2341
- PrintOptions &Options) {
2341
+ void PrintAST::printExtendedTypeName (TypeLoc ExtendedTypeLoc) {
2342
2342
bool OldFullyQualifiedTypesIfAmbiguous =
2343
2343
Options.FullyQualifiedTypesIfAmbiguous ;
2344
2344
Options.FullyQualifiedTypesIfAmbiguous =
@@ -2348,9 +2348,8 @@ static void printExtendedTypeName(Type ExtendedType, ASTPrinter &Printer,
2348
2348
};
2349
2349
2350
2350
// Strip off generic arguments, if any.
2351
- auto Ty = ExtendedType->getAnyNominal ()->getDeclaredType ();
2352
-
2353
- Ty->print (Printer, Options);
2351
+ auto Ty = ExtendedTypeLoc.getType ()->getAnyNominal ()->getDeclaredType ();
2352
+ printTypeLoc (TypeLoc (ExtendedTypeLoc.getTypeRepr (), Ty));
2354
2353
}
2355
2354
2356
2355
@@ -2408,7 +2407,7 @@ void PrintAST::printSynthesizedExtension(Type ExtendedType,
2408
2407
printAttributes (ExtDecl);
2409
2408
Printer << tok::kw_extension << " " ;
2410
2409
2411
- printExtendedTypeName (ExtendedType, Printer, Options );
2410
+ printExtendedTypeName (TypeLoc::withoutLoc ( ExtendedType) );
2412
2411
printInherited (ExtDecl);
2413
2412
2414
2413
// We may need to combine requirements from ExtDecl (which has the members
@@ -2459,7 +2458,7 @@ void PrintAST::printExtension(ExtensionDecl *decl) {
2459
2458
printTypeLoc (TypeLoc::withoutLoc (extendedType));
2460
2459
return ;
2461
2460
}
2462
- printExtendedTypeName (extendedType, Printer, Options );
2461
+ printExtendedTypeName (TypeLoc (decl-> getExtendedTypeRepr (), extendedType) );
2463
2462
});
2464
2463
printInherited (decl);
2465
2464
0 commit comments