Skip to content

[CSBinding] Infer key path root bindings transitively through context… #70212

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 3 commits into from
Dec 9, 2023

Conversation

xedin
Copy link
Contributor

@xedin xedin commented Dec 4, 2023

…ual root variable

Since generic arguments have to match exactly the inference could
be extended to transfer bindings through contextual root types if they
are sufficiently resolved (not delayed).

For example if key path expression is passed as an argument to a parameter
like WritableKeyPath<$Root, $Value> and $Root is not yet bound but has
a binding set of {String} its bindings are transferable over to resolve the
key path which would be ultimately bound to the contextual type.

Resolves: rdar://102384255

@xedin
Copy link
Contributor Author

xedin commented Dec 4, 2023

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Dec 4, 2023

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Dec 5, 2023

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Dec 5, 2023

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Dec 5, 2023

@swift-ci please test Windows platform

xedin added 3 commits December 7, 2023 14:09
…tual root variable

Since generic arguments have to match exactly the inference could
be extended to transfer bindings through contextual root types if
they are sufficiently resolved (not delayed).

For example if key path expression is passed as an argument to
a parameter like `WritableKeyPath<$Root, $Value>` and `$Root`
is not yet bound but has a binding set of `{String}` its bindings
are transferable over to resolve the key path which would be
ultimately bound to the contextual type.
…djacent vars

Binding inference through a contextual root variable should include
marking contextual root and all of its adjacent variables as adjacent
to a key path root variable as well otherwise transitively inferred
bindings are ranked incorrectly.
This makes sure that we never run into infinite recursion situations
with transitive bindings that could have been aseembled and not
properly checked.
@xedin
Copy link
Contributor Author

xedin commented Dec 7, 2023

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Dec 7, 2023

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Dec 8, 2023

@swift-ci please test Linux platform

@xedin
Copy link
Contributor Author

xedin commented Dec 8, 2023

@swift-ci please test

@xedin
Copy link
Contributor Author

xedin commented Dec 8, 2023

@swift-ci please test source compatibility

2 similar comments
@xedin
Copy link
Contributor Author

xedin commented Dec 8, 2023

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Dec 8, 2023

@swift-ci please test source compatibility

@xedin
Copy link
Contributor Author

xedin commented Dec 9, 2023

Source compatibility suite is having unrelated issues, I'm just going to land this since it passed before without the last commit which shouldn't have any effect.

@xedin xedin merged commit 80e86dd into swiftlang:main Dec 9, 2023
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.

1 participant