Skip to content

[5.5][CSBindings] Fix inference of partial key path from conversion constraints #37791

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

Merged
merged 1 commit into from
Jun 6, 2021

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Jun 4, 2021

Cherry-pick of #37679


  • Explanation:

Fixes a long standing issue in key path inference where type-checker would reject
expressions because it couldn't infer correct key path type from context.

It's not permitted to use PartialKeyPath type to resolve a key path
expression, because that type is intended to be a type-erased version of
a fully resolved KeyPath type.

In situations where contextual type is a partial key path (e.g. parameter
type is a partial key path), let's replace it with a KeyPath type that
is a subtype of PartialKeyPath and allow value inference to happen.

Resolves: SR-5667
Resolves: rdar://32365183

@xedin xedin requested a review from a team as a code owner June 4, 2021 20:22
@xedin xedin added the r5.5 label Jun 4, 2021
@xedin
Copy link
Contributor Author

xedin commented Jun 4, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Jun 4, 2021

Build failed
Swift Test Linux Platform
Git Sha - d7b987efa85bac2c6a870f63cd2a2397f074eeea

@swift-ci
Copy link
Contributor

swift-ci commented Jun 4, 2021

Build failed
Swift Test OS X Platform
Git Sha - d7b987efa85bac2c6a870f63cd2a2397f074eeea

…aints

It's not permitted to use `PartialKeyPath` type to resolve a key path
expression, because that type is intended to be a type-erased version of
a fully resolved `KeyPath` type.

In situations where contextual type is a partial key path (e.g. parameter
type is a partial key path), let's replace it with a `KeyPath` type that
is a subtype of `PartialKeyPath` and allow value inference to happen.

Resolves: SR-5667
Resolves: rdar://32365183
@xedin xedin force-pushed the rdar-32365183-5.5 branch from d7b987e to 349250d Compare June 4, 2021 21:37
@xedin
Copy link
Contributor Author

xedin commented Jun 4, 2021

@swift-ci please test

@xedin xedin merged commit c39c0a0 into swiftlang:release/5.5 Jun 6, 2021
@AnthonyLatsis AnthonyLatsis added 🍒 release cherry pick Flag: Release branch cherry picks swift 5.5 labels Jan 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍒 release cherry pick Flag: Release branch cherry picks swift 5.5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants