Skip to content

Conversation

@DougGregor
Copy link
Member

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:

  • Test pull request on Swift continuous integration.

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

Platform Comment
All supported platforms @swift-ci Please smoke test
OS X platform @swift-ci Please smoke test OS X platform
Linux platform @swift-ci Please smoke test Linux platform

Validation Testing

Platform Comment
All supported platforms @swift-ci Please test
OS X platform @swift-ci Please test OS X platform
Linux platform @swift-ci Please test Linux platform

Note: Only members of the Apple organization can trigger swift-ci.

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
@DougGregor
Copy link
Member Author

@swift-ci please test

@DougGregor DougGregor added this to the Swift 3.0 Preview 1 milestone May 22, 2016
/// Whether the names have corresponding source locations.
unsigned HaveSourceLocations : 1;
};
enum { NumObjCKeyPathExprBits = NumExprBits + 17 };
Copy link
Contributor

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?

Copy link
Member Author

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.

@DougGregor
Copy link
Member Author

@swift-ci please test

@jopamer
Copy link
Contributor

jopamer commented May 23, 2016

Looks great!

@DougGregor
Copy link
Member Author

Added ChangeLog entry, now we're good to go.

@tkremenek tkremenek merged commit ba067bd into swift-3.0-preview-1-branch May 23, 2016
@tkremenek tkremenek deleted the se-0062-branch branch May 23, 2016 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants