Skip to content

Commit 53aa1ae

Browse files
Add support for 'union' symbol kinds (#785)
rdar://120374980
1 parent 90a56b8 commit 53aa1ae

File tree

9 files changed

+361
-160
lines changed

9 files changed

+361
-160
lines changed

Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/SwiftDocC/Infrastructure/Topic Graph/AutomaticCuration.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021-2022 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -214,6 +214,7 @@ extension AutomaticCuration {
214214
case .`typeProperty`: return "Type Properties"
215215
case .`typeSubscript`: return "Type Subscripts"
216216
case .`typealias`: return "Type Aliases"
217+
case .union: return "Unions"
217218
case .`var`: return "Variables"
218219
case .module: return "Modules"
219220
case .extendedModule: return "Extended Modules"
@@ -236,6 +237,7 @@ extension AutomaticCuration {
236237
.`class`,
237238
.`protocol`,
238239
.`struct`,
240+
.`union`,
239241
.`httpRequest`,
240242
.`dictionary`,
241243
.`var`,

Sources/SwiftDocC/Model/DocumentationNode.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021-2023 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -527,6 +527,7 @@ public struct DocumentationNode {
527527
case .`typeProperty`: return .typeProperty
528528
case .`typeSubscript`: return .typeSubscript
529529
case .`typealias`: return .typeAlias
530+
case .union: return .union
530531
case .`var`: return .globalVariable
531532
case .module: return .module
532533
case .extendedModule: return .extendedModule

Tests/SwiftDocCTests/Infrastructure/AutomaticCurationTests.swift

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2021-2022 Apple Inc. and the Swift project authors
4+
Copyright (c) 2021-2024 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See https://swift.org/LICENSE.txt for license information
@@ -551,13 +551,13 @@ class AutomaticCurationTests: XCTestCase {
551551
)
552552
}
553553

554-
func testNamespacesAreCuratedProperly() throws {
555-
let (bundle, context) = try testBundleAndContext(named: "CxxNamespaces")
554+
func testCPlusPlusSymbolsAreCuratedProperly() throws {
555+
let (bundle, context) = try testBundleAndContext(named: "CxxSymbols")
556556

557557
let rootDocumentationNode = try context.entity(
558558
with: .init(
559559
bundleIdentifier: bundle.identifier,
560-
path: "/documentation/CxxNamespaces",
560+
path: "/documentation/CxxSymbols",
561561
sourceLanguage: .objectiveC
562562
)
563563
)
@@ -573,7 +573,10 @@ class AutomaticCurationTests: XCTestCase {
573573
},
574574
[
575575
"Namespaces",
576-
"/documentation/CxxNamespaces/Foo",
576+
"/documentation/CxxSymbols/Foo",
577+
578+
"Unions",
579+
"/documentation/CxxSymbols/MyUnion",
577580
]
578581
)
579582
}

Tests/SwiftDocCTests/Test Bundles/CxxNamespaces.docc/CxxNamespaces.md

Lines changed: 0 additions & 6 deletions
This file was deleted.

Tests/SwiftDocCTests/Test Bundles/CxxNamespaces.docc/CxxNamespaces.symbols.json

Lines changed: 0 additions & 144 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# ``CxxSymbols``
2+
3+
This bundle contains a small symbol graph that demonstrates symbol kinds added in Clang's C++
4+
support as currently reflected on its main branch.
5+
6+
<!-- Copyright (c) 2023-2024 Apple Inc and the Swift Project authors. All Rights Reserved. -->

0 commit comments

Comments
 (0)