Debian Codegraph @

gopls/internal/test/marker/testdata/codeaction/removeparam_satisfies.txt

raw
1 This test verifies that gopls can remove unused parameters from methods,
2 when that method satisfies an interface.
3
4 For now, we just update static calls. In the future, we should compute the set
5 of dynamic calls that must change (and therefore, the set of concrete functions
6 that must be modified), in order to produce the desired outcome for our users.
7
8 Doing so would be more complicated, so for now this test simply records the
9 current behavior.
10
11 -- go.mod --
12 module example.com/rm
13
14 go 1.20
15
16 -- p.go --
17 package rm
18
19 type T int
20
21 func (t T) Foo(x int) { //@codeaction("x", "refactor.rewrite.removeUnusedParam", result=basic)
22 }
23
24 -- @basic/p.go --
25 package rm
26
27 type T int
28
29 func (t T) Foo() { //@codeaction("x", "refactor.rewrite.removeUnusedParam", result=basic)
30 }
31
32 -- @basic/use/use.go --
33 package use
34
35 import "example.com/rm"
36
37 type Fooer interface {
38 Foo(int)
39 }
40
41 var _ Fooer = rm.T(0)
42
43 func _() {
44 var x rm.T
45 x.Foo()
46 }
47 -- use/use.go --
48 package use
49
50 import "example.com/rm"
51
52 type Fooer interface{
53 Foo(int)
54 }
55
56 var _ Fooer = rm.T(0)
57
58 func _() {
59 var x rm.T
60 x.Foo(1)
61 }