-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
Description
After #73078 the @TaskLocal
macro (which used to be a property wrapper) generates the projected value property without specifying access control, making such property internal, and inaccessible from another module.
For example, we are using this utility module:
https://github.com/pointfreeco/xctest-dynamic-overlay/blob/698be4131e778c2dd15ea47be0523280328bc2db/Sources/XCTestDynamicOverlay/XCTFail.swift#L4
public struct XCTFailContext: Sendable {
@TaskLocal public static var current: Self?
}
and then a consumer module is accessing its projected value:
XCTFailContext.$current.withValue(...) { ... }
After this change this code no longer compiles, as it complains that $current is now internal.
According to the property wrapper rules the $current
projected value property should be public and accessible. Is that correct, or are TaskLocal properties special?
Reproduction
import XCTestDynamicOverlay
func test() {
XCTFailContext.$current.withValue(XCTFailContext(file: "abc", line: 123)) {
}
}
Expected behavior
This sample should compile, but instead it errors out:
XCTFailContext.$current.withValue(XCTFailContext(file: "abc", line: 123)) {
| `- error: '$current' is inaccessible due to 'internal' protection level
Environment
Swift main
Additional information
No response