Skip to content

Commit 8e17be1

Browse files
committed
Fixup Extension Printing
1 parent 8d22702 commit 8e17be1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2107,11 +2107,17 @@ void PrintAST::printExtension(ExtensionDecl *decl) {
21072107
recordDeclLoc(decl, [&]{
21082108
// We cannot extend sugared types.
21092109
Type extendedType = decl->getExtendedType();
2110-
if (!extendedType || !extendedType->getAnyNominal()) {
2110+
if (!extendedType) {
21112111
// Fallback to TypeRepr.
21122112
printTypeLoc(decl->getExtendedTypeRepr());
21132113
return;
21142114
}
2115+
if (!extendedType->getAnyNominal()) {
2116+
// Fallback to the type. This usually means we're trying to print an
2117+
// UnboundGenericType.
2118+
printTypeLoc(TypeLoc::withoutLoc(extendedType));
2119+
return;
2120+
}
21152121
printExtendedTypeName(extendedType, Printer, Options);
21162122
});
21172123
printInherited(decl);

0 commit comments

Comments
 (0)