-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Implement SE-0062: Referencing Objective-C key-paths #2640
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
Implement the Objective-C #keyPath expression, which maps a sequence of @objc property accesses to a key-path suitable for use with Cocoa[Touch]. The implementation handles @objc properties of types that are either @objc or can be bridged to Objective-C, including the collections that work with key-value coding (Array/NSArray, Dictionary/NSDictionary, Set/NSSet). Still to come: code completion support and Fix-Its to migrate string literal keypaths to #keyPath. Implements the bulk of SR-1237 / rdar://problem/25710611.
Implement code completion support for Objective-C #keyPath expressions, using semantic analysis of the partially-typed keypath argument to provide an appropriate set of results (i.e., just properties and types). This implements all of the necessary parts of SE-0062 / SR-1237 / rdar://problem/25710611, although at some point I'd like to follow it up with some warnings to help migrate existing string literals to
|
@swift-ci please test |
include/swift/AST/Expr.h
Outdated
| /// Whether the names have corresponding source locations. | ||
| unsigned HaveSourceLocations : 1; | ||
| }; | ||
| enum { NumObjCKeyPathExprBits = NumExprBits + 17 }; |
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.
Where does 17 come from?
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.
Good catch! I removed a field and didn't update the bit count.
|
@swift-ci please test |
|
Looks great! |
|
Added ChangeLog entry, now we're good to go. |
What's in this pull request?
This pull request implements SE-0062: Referencing Objective-C key-paths
Resolved bug number: (SR-1237)
Also: rdar://problem/25710611
Before merging this pull request to apple/swift repository:
Triggering Swift CI
The swift-ci is triggered by writing a comment on this PR addressed to the GitHub user @swift-ci. Different tests will run depending on the specific comment that you use. The currently available comments are:
Smoke Testing
Validation Testing
Note: Only members of the Apple organization can trigger swift-ci.