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/gopls: extract-method changes func param from ...T to []T #63287

Closed
adonovan opened this issue Sep 28, 2023 · 1 comment
Closed

x/tools/gopls: extract-method changes func param from ...T to []T #63287

adonovan opened this issue Sep 28, 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

@adonovan
Copy link
Member

Given:

func _() {
	var logf func(string, ...any)
	{
		println(logf)
	}
}

an extract-method operation on the block around println yields:

func _() {
	var logf func(string, ...any)
	{
		newFunction1(logf)
	}
}

func newFunction1(logf func( string,  []any)) {
	println(logf)
}

which doesn't compile because the ...any has become []any. An ellipsis token has clearly been dropped when cloning/synthesizing a tree (or perhaps token.Pos information was zeroed out, which is not semantics-preserving!).

@gopherbot gopherbot added the gopls Issues related to the Go language server, gopls. label Sep 28, 2023
@adonovan adonovan modified the milestones: Go1.19.14, gopls/v0.14.0 Sep 28, 2023
@findleyr findleyr modified the milestones: gopls/v0.14.0, gopls/v0.15.0 Oct 9, 2023
@adonovan adonovan added the Refactoring Issues related to refactoring tools label Dec 1, 2023
@seankhliao seankhliao changed the title gopls: extract-method changes func param from ...T to []T x/tools/gopls: extract-method changes func param from ...T to []T Dec 8, 2023
@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Dec 8, 2023
@adonovan adonovan self-assigned this Jan 12, 2024
@gopherbot
Copy link

Change https://go.dev/cl/555458 mentions this issue: internal/analysisinternal: TypeExpr: don't forget IsVariadic

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