-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strict Concurrency warning false positive: MainActor isolated KeyPath #72181
Comments
Xcode 16 still has this 🐞 |
Filed as #74636 too |
Filed 4 months ago and still unfixed in Swift 6. Meaning you can't use this environment variable while compiling with Swift 6. |
Are there any workarounds available? |
Sorry I missed this - if that happens again, please feel free to add the |
@xedin I think isolated key paths need to understand isolated default values. This code is valid because |
You should be able to work around this by initializing the property wrapper in a import SwiftUI
import StoreKit
@MainActor
struct MyView: View {
@Environment private var requestReview: RequestReviewAction
init() {
self._requestReview = Environment(\.requestReview)
}
var body: some View { ... }
} |
@hborla I appreciate that, but as an external contributor I'm not allowed to add labels to issues I file unfortunately. |
That is annoying! I didn't realize that. It's fine to tag me and I can triage the issue directly. I'm also looking to put a process in place to fill the gaps in issue triage, as I know this isn't the first time an issue has been missed. |
Description
When declaring a property wrapper on a MainActor isolated type that takes a MainActor isolated KeyPath, the 5.10 compiler flags a concurrency warning: 'Cannot form key path to main actor-isolated property 'requestReview'; this is an error in Swift 6'
Reproduction
Expected behavior
No warning.
Environment
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
Additional information
First flagged here: https://forums.swift.org/t/swift-5-10-concurrency-and-xctest/69929/11
The text was updated successfully, but these errors were encountered: