File tree 2 files changed +39
-3
lines changed
2 files changed +39
-3
lines changed Original file line number Diff line number Diff line change @@ -125,8 +125,22 @@ void Symbol::serializeNames(llvm::json::OStream &OS) const {
125
125
OS.attributeObject (" names" , [&](){
126
126
SmallVector<SmallString<32 >, 8 > PathComponents;
127
127
getPathComponents (PathComponents);
128
-
129
- OS.attribute (" title" , PathComponents.back ());
128
+
129
+ if (isa<GenericTypeDecl>(VD)) {
130
+ SmallString<64 > FullyQualifiedTitle;
131
+
132
+ for (const auto *It = PathComponents.begin (); It != PathComponents.end (); ++It) {
133
+ if (It != PathComponents.begin ()) {
134
+ FullyQualifiedTitle.push_back (' .' );
135
+ }
136
+ FullyQualifiedTitle.append (*It);
137
+ }
138
+
139
+ OS.attribute (" title" , FullyQualifiedTitle.str ());
140
+ } else {
141
+ OS.attribute (" title" , PathComponents.back ());
142
+ }
143
+
130
144
Graph->serializeNavigatorDeclarationFragments (" navigator" , *this , OS);
131
145
Graph->serializeSubheadingDeclarationFragments (" subHeading" , *this , OS);
132
146
// "prose": null
Original file line number Diff line number Diff line change 2
2
// RUN: %target-build-swift %s -module-name Names -emit-module -emit-module-path %t/
3
3
// RUN: %target-swift-symbolgraph-extract -module-name Names -I %t -pretty-print -output-dir %t
4
4
// RUN: %FileCheck %s --input-file %t/Names.symbols.json
5
+ // RUN: %FileCheck %s --input-file %t/Names.symbols.json --check-prefix=FUNC
6
+ // RUN: %FileCheck %s --input-file %t/Names.symbols.json --check-prefix=INNERTYPE
7
+ // RUN: %FileCheck %s --input-file %t/Names.symbols.json --check-prefix=INNERTYPEALIAS
5
8
6
- public struct MyStruct { }
9
+ public struct MyStruct {
10
+ public struct InnerStruct { }
7
11
12
+ public typealias InnerTypeAlias = InnerStruct
13
+
14
+ public func foo( ) { }
15
+ }
16
+
17
+ // CHECK-LABEL: "precise": "s:5Names8MyStructV"
8
18
// CHECK: names
9
19
// CHECK-NEXT: "title": "MyStruct"
20
+
21
+ // FUNC-LABEL: "precise": "s:5Names8MyStructV3fooyyF",
22
+ // FUNC: names
23
+ // FUNC-NEXT: "title": "foo()"
24
+
25
+ // INNERTYPE-LABEL: "precise": "s:5Names8MyStructV05InnerC0V"
26
+ // INNERTYPE: names
27
+ // INNERTYPE-NEXT: "title": "MyStruct.InnerStruct"
28
+
29
+ // INNERTYPEALIAS-LABEL: "precise": "s:5Names8MyStructV14InnerTypeAliasa"
30
+ // INNERTYPEALIAS: names
31
+ // INNERTYPEALIAS-NEXT: "title": "MyStruct.InnerTypeAlias"
You can’t perform that action at this time.
0 commit comments