Skip to content

[CS] Make resolveLocatorToDecl simpler and more robust #27836

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 6 commits into from
Oct 23, 2019

Conversation

hamishknight
Copy link
Contributor

Rather than attempting to pull out a concrete callee reference from the rewritten function expression, this PR changes the logic such that we retrieve the callee from the solution using a callee locator computed before the apply is rewritten, and then pass this callee down through finishApply and coerceCallArguments.

Resolves SR-11648.

This is a convenience member for computing the
contextual substitutions for a decl reference at
a given locator.
Some clients may only want a callee locator for an
immediate decl reference such as `x.foo`, but not
for `x.foo()`.
Rather than attempting to pull out a concrete decl
ref from the rewritten function expr, retrieve the
callee from the solution using a callee locator
computed before the apply is rewritten, and then
pass this callee down through `finishApply` and
`coerceCallArguments`.

Resolves SR-11648.
This ensures we don't have to compute the substitutions
multiple times when, for example, rewriting an
apply of generic function.
@hamishknight hamishknight requested a review from xedin October 22, 2019 20:13
@hamishknight
Copy link
Contributor Author

@swift-ci please test

@hamishknight
Copy link
Contributor Author

hamishknight commented Oct 22, 2019

@swift-ci please test source compatibility

Results: Debug (PASS) – Release (PASS)

@hamishknight
Copy link
Contributor Author

@swift-ci please smoke test

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thank you!

@hamishknight
Copy link
Contributor Author

@swift-ci please smoke test

@hamishknight hamishknight merged commit c95ef11 into swiftlang:master Oct 23, 2019
@hamishknight hamishknight deleted the second-hand-callees branch October 23, 2019 22:11
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