[5.5][CSBindings] Fix inference of partial key path from conversion constraints #37791
+82
−16
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.
Cherry-pick of #37679
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 pathexpression, 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 thatis a subtype of
PartialKeyPath
and allow value inference to happen.Scope: Passing key path literal as an argument to
PartialKeyPath
parameter and/orother situations where
PartialKeyPath
could be inferred directly from context.Main Branch PR: [CSBindings] Fix inference of partial key path from conversion constraints #37679
Resolves: rdar://32365183
Risk: Low
Reviewed By: @hborla
Testing: Regression tests added to the suite
Resolves: SR-5667
Resolves: rdar://32365183