Skip to content

Commit d579d5c

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 d579d5c

File tree

1 file changed

+29
-5
lines changed

1 file changed

+29
-5
lines changed

Tests/SourceKitLSPTests/SwiftInterfaceTests.swift

Lines changed: 29 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,31 @@ 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(
403+
*,
404+
deprecated,
405+
message: "temporary workaround for '_Concurrency.swiftinterface' should no longer be necessary"
406+
)
407+
#endif
408+
private func assertSystemSwiftInterface(
409+
uri: DocumentURI,
410+
position: Position,
411+
testClient: TestSourceKitLSPClient,
412+
swiftInterfaceFiles: [String],
413+
linePrefix: String,
414+
line: UInt = #line
390415
) async throws {
391416
let definition = try await testClient.send(
392417
DefinitionRequest(
@@ -395,10 +420,9 @@ private func assertSystemSwiftInterface(
395420
)
396421
)
397422
let location = try XCTUnwrap(definition?.locations?.only)
398-
XCTAssertEqual(
399-
location.uri.fileURL?.lastPathComponent,
400-
swiftInterfaceFile,
401-
"Path was: '\(location.uri.pseudoPath)'",
423+
XCTAssert(
424+
(location.uri.fileURL?.lastPathComponent).map(swiftInterfaceFiles.contains) ?? false,
425+
"Path '\(location.uri.pseudoPath)' did not match any of \(String(reflecting: swiftInterfaceFiles))",
402426
line: line
403427
)
404428
// load contents of swiftinterface

0 commit comments

Comments
 (0)