Skip to content
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

x/tools/internal/refactor/inline,x/tools/gopls: undo variadic elimination when it is safe to do so #63717

Open
findleyr opened this issue Oct 24, 2023 · 1 comment
Assignees
Labels
gopls Issues related to the Go language server, gopls. Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@findleyr
Copy link
Contributor

findleyr commented Oct 24, 2023

Follow up on this comment on a semi-automated CL: https://go-review.googlesource.com/c/tools/+/537475/1/gopls/internal/lsp/source/rename.go#973

The inliner should undo variadic elimination (packing variadic arguments as []T{...}) when it is safe to do so. As a result of the current logic, the inliner may introduce this redundancy at the callsite.

CC @adonovan

@findleyr findleyr added gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. labels Oct 24, 2023
@findleyr findleyr added this to the gopls/v0.15.0 milestone Oct 24, 2023
@findleyr findleyr added the Refactoring Issues related to refactoring tools label Oct 24, 2023
@adonovan
Copy link
Member

adonovan commented Oct 25, 2023

FWIW, "Safe to do so" means there is exactly one use of the parameter in the callee body and it is the final argument of an ellipsis call f(param...).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls Issues related to the Go language server, gopls. Refactoring Issues related to refactoring tools Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

3 participants