Debian Codegraph @

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

raw
1 Test that refactor.inline.variable adds parens as needed to preserve
2 operator precedence (go.dev/issue/77381).
3
4 -- go.mod --
5 module example.com/a
6 go 1.18
7
8 -- a/a.go --
9 package a
10
11 func _() {
12 x := 3 + 4
13 print(x) //@codeaction("x", "refactor.inline.variable", result=one)
14 print(2 * x) //@codeaction("x", "refactor.inline.variable", result=two)
15 }
16 -- @one/a/a.go --
17 package a
18
19 func _() {
20 x := 3 + 4
21 print(3 + 4) //@codeaction("x", "refactor.inline.variable", result=one)
22 print(2 * x) //@codeaction("x", "refactor.inline.variable", result=two)
23 }
24 -- @two/a/a.go --
25 package a
26
27 func _() {
28 x := 3 + 4
29 print(x) //@codeaction("x", "refactor.inline.variable", result=one)
30 print(2 * (3 + 4)) //@codeaction("x", "refactor.inline.variable", result=two)
31 }