Skip to content

Commit 5ece925

Browse files
committed
Adjust test to reflect _Concurrency module hiding
swiftlang/swift#84358 makes the `_Concurrency` module behave like a cross-import overlay of `Swift`. This changes downstream behavior in SourceKit-LSP. Update a test to reflect that change.
1 parent 016a0b1 commit 5ece925

File tree

1 file changed

+25
-5
lines changed

1 file changed

+25
-5
lines changed

Tests/SourceKitLSPTests/SwiftInterfaceTests.swift

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ final class SwiftInterfaceTests: XCTestCase {
104104
uri: project.fileURI,
105105
position: project.positions["3️⃣"],
106106
testClient: project.testClient,
107-
swiftInterfaceFile: "_Concurrency.swiftinterface",
107+
swiftInterfaceFiles: ["Swift.swiftinterface", "_Concurrency.swiftinterface"],
108108
linePrefix: "@inlinable public func withTaskGroup"
109109
)
110110
}
@@ -387,6 +387,27 @@ private func assertSystemSwiftInterface(
387387
swiftInterfaceFile: String,
388388
linePrefix: String,
389389
line: UInt = #line
390+
) async throws {
391+
try await assertSystemSwiftInterface(
392+
uri: uri,
393+
position: position,
394+
testClient: testClient,
395+
swiftInterfaceFiles: [swiftInterfaceFile],
396+
linePrefix: linePrefix,
397+
line: line
398+
)
399+
}
400+
401+
#if compiler(>=6.4)
402+
@available(*, deprecated, message: "temporary workaround for '_Concurrency.swiftinterface' should no longer be necessary")
403+
#endif
404+
private func assertSystemSwiftInterface(
405+
uri: DocumentURI,
406+
position: Position,
407+
testClient: TestSourceKitLSPClient,
408+
swiftInterfaceFiles: [String],
409+
linePrefix: String,
410+
line: UInt = #line
390411
) async throws {
391412
let definition = try await testClient.send(
392413
DefinitionRequest(
@@ -395,10 +416,9 @@ private func assertSystemSwiftInterface(
395416
)
396417
)
397418
let location = try XCTUnwrap(definition?.locations?.only)
398-
XCTAssertEqual(
399-
location.uri.fileURL?.lastPathComponent,
400-
swiftInterfaceFile,
401-
"Path was: '\(location.uri.pseudoPath)'",
419+
XCTAssert(
420+
(location.uri.fileURL?.lastPathComponent).map(swiftInterfaceFiles.contains) ?? false,
421+
"Path '\(location.uri.pseudoPath)' did not match any of \(String(reflecting: swiftInterfaceFiles))",
402422
line: line
403423
)
404424
// load contents of swiftinterface

0 commit comments

Comments
 (0)