Skip to content

Commit 2862db1

Browse files
committed
[concurrency] Use nonisolated(unsafe) to quiet an error in runAsync in the tests.
Specifically, we are already using XCTest expectations to make sure we are waiting long enough. So it is appropriate to put nonisolated(unsafe) since we are synchronizing the code in a way that swift concurrency does not understand. This came up as part of fixing rdar://164042741.
1 parent 95f2fc6 commit 2862db1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Tests/SwiftSourceKitPluginTests/SwiftSourceKitPluginTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2172,7 +2172,7 @@ private struct ExpectationNotFulfilledError: Error {}
21722172

21732173
/// Run the given async block and block the current function until `body` terminates.
21742174
private func runAsync<T: Sendable>(_ body: @escaping @Sendable () async throws -> T) throws -> T {
2175-
var result: Result<T, Error>!
2175+
nonisolated(unsafe) var result: Result<T, Error>!
21762176
let expectation = XCTestExpectation(description: "")
21772177
Task {
21782178
do {

0 commit comments

Comments
 (0)