Description
I'm trying to understand the difference between these two forms. I think they should be equivalent, but the global actor version works and the isolation param version does not.
Reproduction
class Argument {
}
class NonSendable {
public func noArgument(closure: () -> Void) {
}
public func isolatedNoArgument(isolation: isolated (any Actor)? = #isolation, value: Argument) {
noArgument() {
Task {
_ = isolation
// ERROR: Sending 'value' risks causing data races
print(value)
}
}
}
@MainActor
public func globalActorArgument(value: Argument) {
noArgument() {
Task {
print(value)
}
}
}
}
Expected behavior
I expected both of these versions to compile with no error.
Environment
Apple Swift version 6.0-dev (LLVM 3751470251df3e4, Swift 026ffdd)
Target: arm64-apple-macosx14.0
Additional information
No response
Description
I'm trying to understand the difference between these two forms. I think they should be equivalent, but the global actor version works and the isolation param version does not.
Reproduction
Expected behavior
I expected both of these versions to compile with no error.
Environment
Apple Swift version 6.0-dev (LLVM 3751470251df3e4, Swift 026ffdd)
Target: arm64-apple-macosx14.0
Additional information
No response