Implement SE-0062: Referencing Objective-C key-paths#2640
Merged
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
Member
Author
|
@swift-ci please test |
| /// Whether the names have corresponding source locations. | ||
| unsigned HaveSourceLocations : 1; | ||
| }; | ||
| enum { NumObjCKeyPathExprBits = NumExprBits + 17 }; |
Member
Author
There was a problem hiding this comment.
Good catch! I removed a field and didn't update the bit count.
Member
Author
|
@swift-ci please test |
Contributor
|
Looks great! |
Member
Author
|
Added ChangeLog entry, now we're good to go. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.