Skip to content

Commit a0e502d

Browse files
committed
fix tests that used manipulated symbol graphs and were missing parent-child relationships relevant for new collision detection
The test used a manipulated Symbol Graph File with a duplicate symbol. However, the duplicate was not connected to the parent of the original. Thus, the new algorithm anticipated that its MyClass path component would be cut out. Therefore, the two initializers had different paths that no longer conflicted.
1 parent 06cdfd2 commit a0e502d

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Sources/SwiftDocC/Infrastructure/DocumentationContext.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2578,7 +2578,7 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
25782578
if let match = referencesIndex[path] { return match }
25792579

25802580
// Check if `destination` is a known absolute symbol path...
2581-
if !path.hasPrefix("/") {
2581+
if !path.hasPrefix("/") && parent.pathComponents.count > 2 {
25822582
// ...in the parent's module
25832583
let parentModule = parent.pathComponents[2]
25842584
let referenceURLString = "doc://\(parent.bundleIdentifier)/documentation/\(parentModule)/\(path)"

Tests/SwiftDocCTests/Infrastructure/DocumentationContext/DocumentationContextTests.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1758,6 +1758,11 @@ let expected = """
17581758

17591759
text = text.replacingOccurrences(of: "\"relationships\" : [", with: """
17601760
"relationships" : [
1761+
{
1762+
"source" : "s:7SideKit0A5ClassC10testSV",
1763+
"target" : "s:7SideKit0A5ClassC",
1764+
"kind" : "memberOf"
1765+
},
17611766
{
17621767
"source" : "s:7SideKit0A5ClassC10testE",
17631768
"target" : "s:7SideKit0A5ClassC",

Tests/SwiftDocCTests/Test Bundles/TestBundle.docc/mykit-iOS.symbols.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -552,6 +552,11 @@
552552
"source" : "s:5MyKit0A5ClassCACycfc",
553553
"target" : "s:5MyKit0A5ClassC",
554554
"kind" : "memberOf"
555+
},
556+
{
557+
"source" : "s:5MyKit0A5ClassCACycfcDUPLICATE",
558+
"target" : "s:5MyKit0A5ClassC",
559+
"kind" : "memberOf"
555560
}
556561
]
557562
}

0 commit comments

Comments
 (0)