-
Notifications
You must be signed in to change notification settings - Fork 114
Locked
shouldn't be a property wrapper.
#185
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
Locked
shouldn't be a property wrapper.
#185
Conversation
Property wrappers, when used as static properties, are inherently concurrency-unsafe (because they must be `var`, not `let`.) Discussed with the core Swift folks; this PR removes property wrapper "conformance" from `Locked`, adds `RawRepresentable` to replace it, and modifies call sites as appropriate. Resolves rdar://121054518.
@swift-ci please test |
1 similar comment
@swift-ci please test |
@swift-ci please clean test |
Sources/Testing/Support/Locked.swift
Outdated
@@ -25,7 +25,6 @@ private import TestingInternals | |||
/// - Bug: The state protected by this type should instead be protected using | |||
/// actor isolation, but actor-isolated functions cannot be called from | |||
/// synchronous functions. ([83888717](rdar://83888717)) | |||
@propertyWrapper | |||
struct Locked<T>: @unchecked Sendable where T: Sendable { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still think the single word "Locked" is a good name for this type, given that it's no longer a property wrapper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine, because you'd pronounce it Locked<Int>
or similar. I'm open to alternatives (LockedValue<Int>
sounds silly to me though.)
@swift-ci please test |
CI failures are unrelated to this PR and are being tracked elsewhere; changes have been verified at desk on Linux and macOS. |
Follow-up to #185. I missed a use of `wrappedValue` and because our CI is broken, I didn't notice the failure.
Follow-up to #185. I missed a use of `wrappedValue` and because our CI is broken, I didn't notice the failure.
Property wrappers, when used as static properties, are inherently concurrency-unsafe (because they must be
var
, notlet
.) Discussed with the core Swift folks; this PR removes property wrapper "conformance" fromLocked
, addsRawRepresentable
to replace it, and modifies call sites as appropriate.Resolves rdar://121054518.
Checklist: