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

Elision and variadic parameters #33

Open
aws5295 opened this issue Jul 16, 2021 · 1 comment
Open

Elision and variadic parameters #33

aws5295 opened this issue Jul 16, 2021 · 1 comment

Comments

@aws5295
Copy link

aws5295 commented Jul 16, 2021

Elision does not seem to match variadic parameters - which also use the ... notation.
Below is a simple repro.

Patch file (goal is to swap order of first 2 parameters only):

@@
var first expression
var second expression
@@
-bar(second, first,...)
+bar(first, second,...)

Input:

func foo() {
	bar("b", "a")
	bar("b", "a", "c")
	bar("b", "a", []string{"c"}...)
}

Output:

func foo() {
	bar("a", "b")
	bar("a", "b", "c")
        // Expected: bar("a", "b", []string{"c"}...)
	bar("b", "a", []string{"c"}...)
}
@abhinav
Copy link
Contributor

abhinav commented Aug 9, 2021

Thanks for the report @aws5295! We'll work on addressing this.

(Internal tracking task: GO-786.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants