Skip to content
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

Runtime support for identity key paths. #18804

Merged
merged 2 commits into from
Aug 21, 2018

Conversation

jckarter
Copy link
Contributor

@jckarter jckarter commented Aug 17, 2018

Make sure the implementation can handle a key path with zero components by removing inappropriate assumptions that the number of components is always non-empty. Identity key paths also need some special behavior:

  • Appending an identity key path should be an identity operation for the other operand
  • Identity key paths have a MemoryLayout.offset(of:) zero
  • Identity key paths interop with KVC as key paths to @"self"

To be able to exercise and test this behavior, add a Builtin.identityKeyPath() function and WritableKeyPath._identity accessor in lieu of finalized syntax.

rdar://problem/40538312

@jckarter
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 7e62ffad3c846b5f04df495e246b087822349905

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 7e62ffad3c846b5f04df495e246b087822349905

These builtins don't need ownership tracking because they shouldn't ever appear in SIL. NFC
@jckarter
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 7e62ffad3c846b5f04df495e246b087822349905

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 7e62ffad3c846b5f04df495e246b087822349905

@jckarter
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 49b6a092de6deae0f3e7a09675151417d64a7e02

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 49b6a092de6deae0f3e7a09675151417d64a7e02

Make sure the implementation can handle a key path with zero components by removing inappropriate assumptions that the number of components is always non-empty. Identity key paths also need some special behavior:

- Appending an identity key path should be an identity operation for the other operand
- Identity key paths have a `MemoryLayout.offset(of:)` zero
- Identity key paths interop with KVC as key paths to `@"self"`

To be able to exercise and test this behavior, add a `Builtin.identityKeyPath()` function and `WritableKeyPath._identity` accessor in lieu of finalized syntax.
@jckarter
Copy link
Contributor Author

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - e3c51d6a4457d12f5d9b8197ac3a3bd20f919e41

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - e3c51d6a4457d12f5d9b8197ac3a3bd20f919e41

@jckarter jckarter merged commit d3bd01e into swiftlang:master Aug 21, 2018
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.

2 participants