From e09de4b555f4a23c2ae8997aecdabd92ef745294 Mon Sep 17 00:00:00 2001 From: Ian Leitch Date: Thu, 2 Apr 2026 00:14:19 +0200 Subject: [PATCH] Restore Swift-only index store occurrence filtering. Filter non-Swift symbols before building the source graph so mixed Swift/Objective-C projects don't ingest raw extension metadata that triggers extension resolution failures and duplicate USR conflicts. --- CHANGELOG.md | 2 +- Package.resolved | 6 +++--- Package.swift | 2 +- Sources/Indexer/SwiftIndexer.swift | 7 ++++++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5956a751..501bd5daa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,7 +10,7 @@ ##### Bug Fixes -- None. +- Fix mixed Swift/Objective-C indexing failures caused by non-Swift symbols being processed from the index store, which could trigger unknown extension reference errors and duplicate declaration conflicts. ## 3.7.3 (2026-03-31) diff --git a/Package.resolved b/Package.resolved index 286ea6a0e..52c8106d7 100644 --- a/Package.resolved +++ b/Package.resolved @@ -1,5 +1,5 @@ { - "originHash" : "11243e6076e6bead003068dcaef877161ad74a645761e8fa0bd7a5f3f90b7dbf", + "originHash" : "2e444ccf7e9a1075624d35210321a0ac279dfd5cea240ee48ce3c615d9ef85b2", "pins" : [ { "identity" : "aexml", @@ -49,9 +49,9 @@ { "identity" : "swift-index-store", "kind" : "remoteSourceControl", - "location" : "https://github.com/ileitch/swift-index-store", + "location" : "https://github.com/MobileNativeFoundation/swift-index-store", "state" : { - "revision" : "ad6f20532864a2cf3b1e1ee7a084267e94eb68b9" + "revision" : "7edb9a64e084ed64f83b84fb9269d3d1a20c0687" } }, { diff --git a/Package.swift b/Package.swift index 1aa9b3ed1..88510a645 100644 --- a/Package.swift +++ b/Package.swift @@ -7,7 +7,7 @@ var dependencies: [Package.Dependency] = [ .package(url: "https://github.com/tadija/AEXML", from: "4.0.0"), .package(url: "https://github.com/apple/swift-argument-parser", from: "1.0.0"), // Use tag once https://github.com/MobileNativeFoundation/swift-index-store/issues/27 is resolved. - .package(url: "https://github.com/ileitch/swift-index-store", revision: "ad6f20532864a2cf3b1e1ee7a084267e94eb68b9"), + .package(url: "https://github.com/MobileNativeFoundation/swift-index-store", revision: "7edb9a64e084ed64f83b84fb9269d3d1a20c0687"), .package(url: "https://github.com/apple/swift-syntax", from: "603.0.0"), .package(url: "https://github.com/ileitch/swift-filename-matcher", from: "2.0.0"), ] diff --git a/Sources/Indexer/SwiftIndexer.swift b/Sources/Indexer/SwiftIndexer.swift index ef5cbb5a7..91a204c7a 100644 --- a/Sources/Indexer/SwiftIndexer.swift +++ b/Sources/Indexer/SwiftIndexer.swift @@ -162,7 +162,8 @@ final class SwiftIndexer: Indexer { record.forEach(occurrence: { occurrence in let usr = occurrence.symbol.usr - guard let location = self.transformLocation(occurrence.location) + guard Self.shouldProcessOccurrence(occurrence), + let location = self.transformLocation(occurrence.location) else { return } var relations: [RawRelation] = [] @@ -701,6 +702,10 @@ final class SwiftIndexer: Indexer { Location(file: sourceFile, line: input.line, column: input.column) } + static func shouldProcessOccurrence(_ occurrence: SymbolOccurrence) -> Bool { + occurrence.symbol.language == .swift + } + private func transformDeclarationKind(_ kind: SymbolKind, _ subKind: SymbolSubkind) -> Declaration.Kind? { switch subKind { case .accessorGetter: return .functionAccessorGetter