Skip to content

Commit d53c91c

Browse files
committed
[SourceKit][DocInfo] Being consistent of the printed source and the reported annotation when the decl under request is an extension to a name alias type. rdar://22098995
1 parent 627c48c commit d53c91c

File tree

3 files changed

+108
-58
lines changed

3 files changed

+108
-58
lines changed

lib/AST/ASTPrinter.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1268,6 +1268,13 @@ void PrintAST::visitExtensionDecl(ExtensionDecl *decl) {
12681268
Printer << ".";
12691269
}
12701270
}
1271+
1272+
// Respect alias type.
1273+
if (extendedType->getKind() == TypeKind::NameAlias) {
1274+
extendedType.print(Printer, Options);
1275+
return;
1276+
}
1277+
12711278
Printer.printTypeRef(nominal, nominal->getName());
12721279
});
12731280
printInherited(decl);

test/SourceKit/DocSupport/Inputs/cake.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,9 @@ public extension Prot where Self.Element == Int {
2222
public enum MyEnum : Int {
2323
case Blah
2424
}
25+
26+
protocol Prot1 {}
27+
28+
typealias C1Alias = C1
29+
30+
extension C1Alias : Prot1 {}

0 commit comments

Comments
 (0)