blob: f1770b18867967b837d4fafdc1d0a28defc8df33 [file] [log] [blame]
This is a test of the refactor.inline.variable code action.
-- go.mod --
module example.com/a
go 1.18
-- a/a.go --
package a
import "fmt"
func _(x int) {
s := fmt.Sprintf("+%d", x)
println(s) //@codeaction("s", "refactor.inline.variable", result=inlineS)
}
-- @inlineS/a/a.go --
package a
import "fmt"
func _(x int) {
s := fmt.Sprintf("+%d", x)
println(fmt.Sprintf("+%d", x)) //@codeaction("s", "refactor.inline.variable", result=inlineS)
}
-- b/b.go --
package b
import "fmt"
func _(x int) {
s2 := fmt.Sprintf("+%d", x)
{
x := "shadow"
println(s2, x) //@codeaction("s2", "refactor.inline.variable", err=re`refers to "x".*shadowed.*at line 8`)
}
}