Open
Description
The following code produces a concurrency error in Swift 6 mode:
@MainActor
func test_bla() async {
let something = expectation(description: "bla")
Task {
try? await Task.sleep(for: .seconds(1.0))
something.fulfill()
}
await fulfillment(of: [something])
}
(Credit Gero Herk for the sample, from https://forums.swift.org/t/swift-5-10-concurrency-and-xctest/69929/6)
The error is:
await fulfillment(of: [something], timeout: 5)
`- warning: sending main actor-isolated value of type 'SomeXCTestCase' with later accesses to nonisolated context risks causing data races; this is an error in the Swift 6 language mode
This was temporarily fixed for the 5.10
branch using @_unsafeInheritExecutor
: #479, but it is occurring now on Swift 6 OSS toolchains.