-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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/gopls: support change signature refactoring #38028
Comments
We could also use change signature as a suggested fix for the fillreturns analyzer. /cc @joshbaum |
I would greatly appreciate this feature! thanks for your work on gopls by the way 🙂 |
(PING/KEEPALIVE) This thread looks dead, (no movement since October 2020) does this mean that as a noobie GOLANG user I've missed something (obvious to the wise grey haired folk) that makes this a non issue? please advise...txs, Alan |
FWIW this is now very feasible as a result of the inlining work @adonovan has been doing (e.g. #62650): a change signature refactoring can be implemented using inlining by creating a synthetic callee with the new signature, delegating the body of the current callee to the synthetic callee, and inlining the current callee. In other words, Alan has done all the really hard (surprisingly hard) work of making inlining correct and safe, and change signature refactoring is now "just bookkeeping"... Of course, it's not quite that easy:
|
Change https://go.dev/cl/572296 mentions this issue: |
Make a minimal change to the removeparam algorithm to support removing unused parameters of methods. This doesn't address the problem of expanding the set of signatures or calls based on interface satisfaction constraints: that is really a separate concern, which also affects method renaming (golang/go#58461). Were we to have a more general solution to that problem, it would be relatively straightforward to also expand the change signature algorithm. For golang/go#38028 Change-Id: I296cb1f828f07d841c83b1fd33593ccd2fee3539 Reviewed-on: https://go-review.googlesource.com/c/tools/+/572296 Reviewed-by: Alan Donovan <adonovan@google.com> LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Change https://go.dev/cl/581535 mentions this issue: |
Change https://go.dev/cl/631296 mentions this issue: |
Add "move parameter left" and "move parameter right" refactorings, via a more general mechanism for change signature rewrites. As part of this, define a flexible API for change signature, though only parameter permutation is currently supported. For golang/go#38028 Change-Id: I14142d5456904836402d94130f6ee1e32a19066c Reviewed-on: https://go-review.googlesource.com/c/tools/+/581535 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
More for testing and debugging than anything else, allow changing signatures by invoking a renaming on the 'func' keyword. For now, this is still restricted to parameter permutation or removal. For golang/go#38028 Change-Id: I62e387cc7d7f46fc892b7b20050d99fac6800e3f Reviewed-on: https://go-review.googlesource.com/c/tools/+/631296 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Alan Donovan <adonovan@google.com>
gopls@v0.17.0 supports parameter movement refactoring. Moving this to v0.18.0 for the rest: parameter addition and result transformation. |
See microsoft/vscode-go#3122 for the original request.
The text was updated successfully, but these errors were encountered: