-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Concurrency] memberAccessHasSpecialPermissionInSwift5
should treat…
#70555
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
Conversation
@kavon I'd appreciate if you could help me come up with an example that should warn. I looked at the FlowIsolation path and it's ran after |
probably should test both |
Based on my read of FlowIsolation it doesn't matter what kind of access is performed inside, it tracks references. |
init(radians: Double) { | ||
self.radians = radians // Ok | ||
} |
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.
Some suggestions for other things to test for:
- What happens if you init
radians
, escapeself
from the initializer, and then try to accessradians
again? - Same as above but if
radians
is a nonisolated property. - What happens if you try to escape
self
prior toradians
being initialized?
I assume that for all of these, they should work the same as a computed property (which is hopefully already tested). Only (3) is one that is really to ensure FlowIsolation doesn't crash, since it should already get flagged as an error by DI prior.
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.
Otherwise if those are working, then this PR LGTM.
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.
@kavon I had to make some changes to FlowIsolation pass to recognize setter
use of init accessor properties. That cannot be done earlier because only DI knows when to use init accessor and when to use a setter for a particular property.
@swift-ci please test |
… init accessors as stored properties Init accessor properties cannot escape self and are only allowed to initialized and access a set of properties declared in their `@storageRestrictions(...)` attribute. Resolves: swiftlang#70550
… accessor properties Init accessor properties should be handled specifically because they do not reference underlying storage directly via `ref_element_addr` instructions when 'self' is fully initialized.
@swift-ci please test |
escapingSelf(self) | ||
|
||
self.radians = 0 | ||
// expected-warning@-1 {{actor-isolated property 'radians' can not be mutated from a non-isolated context; this is an error in Swift 6}} |
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.
👍🏼
@swift-ci please smoke test macOS platform |
… init accessors as stored properties
Init accessor properties cannot escape self and are only
allowed to initialized and access a set of properties declared
in their
@storageRestrictions(...)
attribute.Resolves: #70550