Skip to content

[CodeCompletion] Fix a crash when completing an argument to a function taking a parameter pack #65720

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

Conversation

ahoppen
Copy link
Member

@ahoppen ahoppen commented May 5, 2023

We previously asserted that for a call the function type had the same number of parameters as the declaration. But that’s not true for parameter packs anymore because the parameter pack will be exploded in the function type to account for passing multiple arguments to the pack.

To fix this, use ConcreteDeclRef instead of a ValueDecl, which has a substitution map and is able to account for the exploded parameter packs when accessed using getParameterAt.

rdar://100066716

…n taking a parameter pack

We previously asserted that for a call the function type had the same number of parameters as the declaration. But that’s not true for parameter packs anymore because the parameter pack will be exploded in the function type to account for passing multiple arguments to the pack.

To fix this, use `ConcreteDeclRef` instead of a `ValueDecl`, which has a substitution map and is able to account for the exploded parameter packs when accessed using `getParameterAt`.

rdar://100066716
@ahoppen ahoppen requested a review from xedin May 5, 2023 22:19
@ahoppen ahoppen requested review from bnbarham and rintaro as code owners May 5, 2023 22:19
@ahoppen
Copy link
Member Author

ahoppen commented May 5, 2023

@swift-ci Please smoke test

@ahoppen ahoppen merged commit a139962 into swiftlang:main May 8, 2023
@ahoppen ahoppen deleted the ahoppen/complete-parameter-pack-arg branch May 8, 2023 17:51
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.

3 participants