The following test function will not compile in the Swift 6 language mode:
@MainActor @Test func example() async {
await confirmation { _ in } // Error: Sending main actor-isolated value of type '(Confirmation) async -> ()' with later accesses to nonisolated context risks causing data races
}
Expected behavior
I think this should just work. confirmation() should take (and respect) an additional isolation argument isolation: isolated (any Actor)? = #isolation.
Swift & OS version (output of swift --version ; uname -a)
swift-driver version: 1.113 Apple Swift version 6.0 (swiftlang-6.0.0.7.6 clang-1600.0.24.1)
Target: arm64-apple-macosx15.0
Darwin Mac.localdomain 24.0.0 Darwin Kernel Version 24.0.0: Wed Aug 7 03:08:56 PDT 2024; root:xnu-11215.1.9~22/RELEASE_ARM64_T6020 arm64
Description
The following test function will not compile in the Swift 6 language mode:
Expected behavior
I think this should just work.
confirmation()
should take (and respect) an additional isolation argumentisolation: isolated (any Actor)? = #isolation
.Proposed new signature (also discussed here):
Actual behavior
No response
Steps to reproduce
No response
swift-testing version/commit hash
Xcode 16 beta 5
Swift & OS version (output of
swift --version ; uname -a
)swift-driver version: 1.113 Apple Swift version 6.0 (swiftlang-6.0.0.7.6 clang-1600.0.24.1) Target: arm64-apple-macosx15.0 Darwin Mac.localdomain 24.0.0 Darwin Kernel Version 24.0.0: Wed Aug 7 03:08:56 PDT 2024; root:xnu-11215.1.9~22/RELEASE_ARM64_T6020 arm64