Debian Codegraph @

gopls/internal/test/marker/testdata/codeaction/inline-lhs-var.txt

raw
1 We should not offer a code action to inline 'v' where it appears on the
2 left-hand side of an assignment
3
4 Regression test for issue #75200.
5
6 -- go.mod --
7 module example.com/a
8 go 1.18
9
10 -- c/c.go --
11 package c
12
13 import "fmt"
14
15 func _() {
16 v := 13
17 v = 78 //@codeaction("v", "refactor.inline.variable", err="0 CodeActions of kind refactor.inline.variable")
18
19 v += 78 //@codeaction("v", "refactor.inline.variable", err="0 CodeActions of kind refactor.inline.variable")
20 v -= 78 //@codeaction("v", "refactor.inline.variable", err="0 CodeActions of kind refactor.inline.variable")
21 v *= 78 //@codeaction("v", "refactor.inline.variable", err="0 CodeActions of kind refactor.inline.variable")
22
23 v++ //@codeaction("v", "refactor.inline.variable", err="0 CodeActions of kind refactor.inline.variable")
24 v-- //@codeaction("v", "refactor.inline.variable", err="0 CodeActions of kind refactor.inline.variable")
25
26 fmt.Println(v)
27
28 x := &v //@codeaction("v", "refactor.inline.variable", err="0 CodeActions of kind refactor.inline.variable")
29 x = (&v) //@codeaction("v", "refactor.inline.variable", err="0 CodeActions of kind refactor.inline.variable")
30 x = &(v) //@codeaction("v", "refactor.inline.variable", err="0 CodeActions of kind refactor.inline.variable")
31
32 fmt.Println(x)
33 }