Skip to content

Commit 2e8a07a

Browse files
encode overload declaration references into render references (#822)
rdar://117805293
1 parent 444b7e7 commit 2e8a07a

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

Sources/SwiftDocC/Model/Rendering/RenderSectionTranslator/DeclarationsSectionTranslator.swift

Lines changed: 4 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
@@ -58,6 +58,9 @@ struct DeclarationsSectionTranslator: RenderSectionTranslator {
5858
identifier: overloadReference.absoluteString
5959
)
6060
)
61+
62+
// Add a topic reference to the overload
63+
renderNodeTranslator.collectedTopicReferences.append(overloadReference)
6164
}
6265
return .init(declarations: otherDeclarations, displayIndex: overloads.displayIndex)
6366
}

Tests/SwiftDocCTests/Rendering/RenderNodeTranslatorTests.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
@@ -1434,6 +1434,8 @@ class RenderNodeTranslatorTests: XCTestCase {
14341434

14351435
for (otherIndex, otherReference) in overloadReferences.indexed() where otherIndex != index {
14361436
XCTAssertTrue(otherDeclarations.declarations.contains(where: { $0.identifier == otherReference.absoluteString }))
1437+
1438+
XCTAssert(renderNode.references.keys.contains(otherReference.absoluteString))
14371439
}
14381440
}
14391441
}

0 commit comments

Comments
 (0)