Skip to content

Commit 5d1b588

Browse files
use fully qualified titles for enum elements
rdar://74051287
1 parent 4be2f3a commit 5d1b588

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

lib/SymbolGraphGen/Symbol.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void Symbol::serializeNames(llvm::json::OStream &OS) const {
120120
SmallVector<PathComponent, 8> PathComponents;
121121
getPathComponents(PathComponents);
122122

123-
if (isa<GenericTypeDecl>(VD)) {
123+
if (isa<GenericTypeDecl>(VD) || isa<EnumElementDecl>(VD)) {
124124
SmallString<64> FullyQualifiedTitle;
125125

126126
for (const auto *It = PathComponents.begin(); It != PathComponents.end(); ++It) {

test/SourceKit/CursorInfo/cursor_symbol_graph.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -745,7 +745,7 @@ enum MyEnum {
745745
// CHECKCASE: "spelling": "someCase"
746746
// CHECKCASE: }
747747
// CHECKCASE: ],
748-
// CHECKCASE: "title": "someCase"
748+
// CHECKCASE: "title": "MyEnum.someCase"
749749
// CHECKCASE: },
750750
// CHECKCASE: "pathComponents": [
751751
// CHECKCASE: "MyEnum",

test/SymbolGraph/Symbols/Names.swift

+14
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,19 @@
55
// RUN: %FileCheck %s --input-file %t/Names.symbols.json --check-prefix=FUNC
66
// RUN: %FileCheck %s --input-file %t/Names.symbols.json --check-prefix=INNERTYPE
77
// RUN: %FileCheck %s --input-file %t/Names.symbols.json --check-prefix=INNERTYPEALIAS
8+
// RUN: %FileCheck %s --input-file %t/Names.symbols.json --check-prefix=INNERENUM
9+
// RUN: %FileCheck %s --input-file %t/Names.symbols.json --check-prefix=INNERCASE
810

911
public struct MyStruct {
1012
public struct InnerStruct {}
1113

1214
public typealias InnerTypeAlias = InnerStruct
1315

1416
public func foo() {}
17+
18+
public enum InnerEnum {
19+
case InnerCase
20+
}
1521
}
1622

1723
// CHECK-LABEL: "precise": "s:5Names8MyStructV"
@@ -29,3 +35,11 @@ public struct MyStruct {
2935
// INNERTYPEALIAS-LABEL: "precise": "s:5Names8MyStructV14InnerTypeAliasa"
3036
// INNERTYPEALIAS: names
3137
// INNERTYPEALIAS-NEXT: "title": "MyStruct.InnerTypeAlias"
38+
39+
// INNERENUM-LABEL: "precise": "s:5Names8MyStructV9InnerEnumO",
40+
// INNERENUM: names
41+
// INNERENUM-NEXT: "title": "MyStruct.InnerEnum"
42+
43+
// INNERCASE-LABEL: "precise": "s:5Names8MyStructV9InnerEnumO0D4CaseyA2EmF",
44+
// INNERCASE: names
45+
// INNERCASE-NEXT: "title": "MyStruct.InnerEnum.InnerCase",

0 commit comments

Comments
 (0)