Swift 6.0.0.5 concurrency regression with default argument value
Description
The following code compiles fine with Xcode 16 beta 2 but fails with beta 3.
Reproduction
actor Actor {
func f() throws {
Task { [weak self] in
// Sending 'self'-isolated value of type 'Int' with later accesses to actor-isolated context risks causing data races
await self?.g()
}
}
private func g(_ n: Int = 1) async -> Int { n }
}
Expected behavior
Compiles
Environment
swift-driver version: 1.111.2 Apple Swift version 6.0 (swiftlang-6.0.0.5.15 clang-1600.0.22.6)
Target: arm64-apple-macosx14.0
Additional information
No response
cc @hborla
@gottesmm this code compiles without errors under -swift-version 6 on main - any idea which region isolation change fixed it? We should check in the test case.
There was the same problem. Do you have any ideas for a solution?
In case it's helpful, this is still an issue in Xcode 16.0 Beta 4 running the following Swift version:
swift-driver version: 1.112.3 Apple Swift version 6.0 (swiftlang-6.0.0.6.8 clang-1600.0.23.1)
Target: arm64-apple-macosx14.0
Same as #75106, this still reproduces with beta 4 when compiling with -warnings-as-errors -warn-concurrency @hborla
Edit: actually also reproduces compiling with swift -swift-version 6 file.swift
I don't think @gottesmm's fixes are included in Beta 4
So the Swift version in beta 4 is over 2 weeks old?
This was fixed by #74757
So the Swift version in beta 4 is over 2 weeks old?
Yes, there is a delay for changes that land on release/6.0 to make it into an Xcode beta, because the changes go through additional testing first.
This seems to be fixed in the Xcode 16.0b6 release!
@dfed Thanks for verifying! Closing!