-
Notifications
You must be signed in to change notification settings - Fork 10.4k
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
[WIP] Property delegates #23440
[WIP] Property delegates #23440
Conversation
@swift-ci please test source compatibility |
3 similar comments
@swift-ci please test source compatibility |
@swift-ci please test source compatibility |
@swift-ci please test source compatibility |
@swift-ci please test source compatibility release |
1 similar comment
@swift-ci please test source compatibility release |
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
@swift-ci please test source compatibility |
1 similar comment
@swift-ci please test source compatibility |
apple/swift-lldb#1402 should fix the LLDB compiler error |
@swift-ci please smoke test |
@swift-ci please build toolchain |
@swift-ci please smoke test |
@swift-ci please build toolchain |
1 similar comment
@swift-ci please build toolchain |
Linux Toolchain (Ubuntu 16.04) Install command |
macOS Toolchain Install command |
@swift-ci please smoke test |
@swift-ci please build toolchain |
@swift-ci please smoke test |
@swift-ci please build toolchain |
Linux Toolchain (Ubuntu 16.04) Install command |
macOS Toolchain Install command |
e0b2d40
to
9212c88
Compare
This makes anything nased on the ASTWalker, such as indexing, also take attached property delegates into account.
…gate. Lift the ban on explicitly defining get/set in a property that has a delegate. Instead, synthesize which of them are missing.
9212c88
to
1adb066
Compare
…tializer. SE-0242 was merged, and I haven't yet figured out how it interacts with property delegates. Disabled default arguments in the memberwise initializer for properties that have delegates until I have a design + implementation.
If a property delegate type's 'value' property has a private setter, don't create a setter for a property that uses that delegate type.
…alValue:)' . The 'value' property and 'init(initialValue:)' initializer cannot have more restrictive access than the property delegate itself. Diagnose this.
Rather than hardcoding the access patterns for the backing property of a property with a delegate, extend the “target implementation” notion used to abstract property access for code synthesis to understand the delegate pattern. This collapses the getter/setter implementation into the “trivial” cases uses the delegate access pattern. As a bonus, we get @_transparent when it makes sense.
A property with a delegate can provide didSet/willSet. Synthesize a setter that calls didSet/willSet appropriately for such properties.
@swift-ci please smoke test |
@swift-ci please build toolchain |
@swift-ci please test source compatibility |
Linux Toolchain (Ubuntu 16.04) Install command |
The implementation to support delegates on local properties has grown past the point where I feel comfortable committing it now, so an delegates on local properties for now.
…egates. Parse custom attributes with the grammer ``` '@' type-identifier expr-paren? ``` When the type-identifier refers to a nominal type with the @propertyDelegate attribute, treat this as being equivalent to ```swift by type-identifier expr-paren? ```
@swift-ci please build toolchain |
1 similar comment
@swift-ci please build toolchain |
This was obsoleted by the "custom attributes" approach |
Proposal: SE-0030. |
This is the implementation of the Property Delegates feature currently being pitched on the forums. Or, you can read the proposal.
The implementation has a few notable limitations: