@@ -1092,7 +1092,9 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
1092
1092
// Making sure that we correctly let decoding memory get released, do not remove the autorelease pool.
1093
1093
try autoreleasepool {
1094
1094
/// We need only unique relationships so we'll collect them in a set.
1095
- var combinedRelationships = [ UnifiedSymbolGraph . Selector : Set < SymbolGraph . Relationship > ] ( )
1095
+ var combinedRelationshipsBySelector = [ UnifiedSymbolGraph . Selector : Set < SymbolGraph . Relationship > ] ( )
1096
+ /// Also track the unique relationships across all languages and platforms
1097
+ var uniqueRelationships = Set < SymbolGraph . Relationship > ( )
1096
1098
/// Collect symbols from all symbol graphs.
1097
1099
var combinedSymbols = [ String: UnifiedSymbolGraph . Symbol] ( )
1098
1100
@@ -1106,7 +1108,8 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
1106
1108
documentLocationMap. reserveCapacity ( symbolReferences. count)
1107
1109
topicGraph. nodes. reserveCapacity ( symbolReferences. count)
1108
1110
topicGraph. edges. reserveCapacity ( symbolReferences. count)
1109
- combinedRelationships. reserveCapacity ( symbolReferences. count)
1111
+ combinedRelationshipsBySelector. reserveCapacity ( symbolReferences. count)
1112
+ uniqueRelationships. reserveCapacity ( symbolReferences. count)
1110
1113
combinedSymbols. reserveCapacity ( symbolReferences. count)
1111
1114
1112
1115
// Iterate over batches of symbol graphs, each batch describing one module.
@@ -1207,15 +1210,17 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
1207
1210
combinedSymbols. merge ( unifiedSymbolGraph. symbols, uniquingKeysWith: { $1 } )
1208
1211
1209
1212
for (selector, relationships) in unifiedSymbolGraph. relationshipsByLanguage {
1210
- combinedRelationships [ selector, default: [ ] ] . formUnion ( relationships)
1213
+ combinedRelationshipsBySelector [ selector, default: [ ] ] . formUnion ( relationships)
1214
+ uniqueRelationships. formUnion ( relationships)
1211
1215
}
1212
1216
1213
1217
// Keep track of relationships that refer to symbols that are absent from the symbol graph, so that
1214
1218
// we can diagnose them.
1215
- combinedRelationships [
1219
+ combinedRelationshipsBySelector [
1216
1220
. init( interfaceLanguage: " unknown " , platform: nil ) ,
1217
1221
default: [ ]
1218
1222
] . formUnion ( unifiedSymbolGraph. orphanRelationships)
1223
+ uniqueRelationships. formUnion ( unifiedSymbolGraph. orphanRelationships)
1219
1224
}
1220
1225
1221
1226
try shouldContinueRegistration ( )
@@ -1305,10 +1310,10 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
1305
1310
}
1306
1311
emitWarningsForSymbolsMatchedInMultipleDocumentationExtensions ( with: symbolsWithMultipleDocumentationExtensionMatches)
1307
1312
symbolsWithMultipleDocumentationExtensionMatches. removeAll ( )
1308
-
1313
+
1309
1314
// Create inherited API collections
1310
1315
try GeneratedDocumentationTopics . createInheritedSymbolsAPICollections (
1311
- relationships: combinedRelationships . flatMap ( \ . value ) ,
1316
+ relationships: uniqueRelationships ,
1312
1317
context: self ,
1313
1318
bundle: bundle
1314
1319
)
@@ -1350,9 +1355,9 @@ public class DocumentationContext: DocumentationContextDataProviderDelegate {
1350
1355
preResolveExternalLinks ( references: Array ( moduleReferences. values) + combinedSymbols. keys. compactMap ( { documentationCache. reference ( symbolID: $0) } ) , localBundleID: bundle. identifier)
1351
1356
1352
1357
// Look up and add symbols that are _referenced_ in the symbol graph but don't exist in the symbol graph.
1353
- try resolveExternalSymbols ( in: combinedSymbols, relationships: combinedRelationships )
1358
+ try resolveExternalSymbols ( in: combinedSymbols, relationships: combinedRelationshipsBySelector )
1354
1359
1355
- for (selector, relationships) in combinedRelationships {
1360
+ for (selector, relationships) in combinedRelationshipsBySelector {
1356
1361
// Build relationships in the completed graph
1357
1362
buildRelationships ( relationships, selector: selector, bundle: bundle)
1358
1363
// Merge into target symbols the member symbols that get rendered on the same page as target.
0 commit comments