File: removeparam_resolve.txt

package info (click to toggle)
golang-golang-x-tools 1%3A0.25.0%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 22,724 kB
  • sloc: javascript: 2,027; asm: 1,645; sh: 166; yacc: 155; makefile: 49; ansic: 8
file content (258 lines) | stat: -rw-r--r-- 4,122 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
This test exercises the refactoring to remove unused parameters, with resolve support.
See removeparam.txt for same test without resolve support.

-- capabilities.json --
{
	"textDocument": {
		"codeAction": {
			"dataSupport": true,
			"resolveSupport": {
				"properties": ["edit"]
			}
		}
	}
}
-- go.mod --
module unused.mod

go 1.18

-- a/a.go --
package a

func A(x, unused int) int { //@codeaction("unused", "unused", "refactor.rewrite", a)
	return x
}

-- @a/a/a.go --
package a

func A(x int) int { //@codeaction("unused", "unused", "refactor.rewrite", a)
	return x
}

-- a/a2.go --
package a

func _() {
	A(1, 2)
}

-- a/a_test.go --
package a

func _() {
	A(1, 2)
}

-- a/a_x_test.go --
package a_test

import "unused.mod/a"

func _() {
	a.A(1, 2)
}

-- b/b.go --
package b

import "unused.mod/a"

func f() int {
	return 1
}

func g() int {
	return 2
}

func _() {
	a.A(f(), 1)
}

-- @a/a/a2.go --
package a

func _() {
	A(1)
}
-- @a/a/a_test.go --
package a

func _() {
	A(1)
}
-- @a/a/a_x_test.go --
package a_test

import "unused.mod/a"

func _() {
	a.A(1)
}
-- @a/b/b.go --
package b

import "unused.mod/a"

func f() int {
	return 1
}

func g() int {
	return 2
}

func _() {
	a.A(f())
}
-- field/field.go --
package field

func Field(x int, field int) { //@codeaction("int", "int", "refactor.rewrite", field, "Refactor: remove unused parameter")
}

func _() {
	Field(1, 2)
}
-- @field/field/field.go --
package field

func Field(field int) { //@codeaction("int", "int", "refactor.rewrite", field, "Refactor: remove unused parameter")
}

func _() {
	Field(2)
}
-- ellipsis/ellipsis.go --
package ellipsis

func Ellipsis(...any) { //@codeaction("any", "any", "refactor.rewrite", ellipsis)
}

func _() {
	// TODO(rfindley): investigate the broken formatting resulting from these inlinings.
	Ellipsis()
	Ellipsis(1)
	Ellipsis(1, 2)
	Ellipsis(1, f(), g())
	Ellipsis(h())
	Ellipsis(i()...)
}

func f() int
func g() int
func h() (int, int)
func i() []any

-- @ellipsis/ellipsis/ellipsis.go --
package ellipsis

func Ellipsis() { //@codeaction("any", "any", "refactor.rewrite", ellipsis)
}

func _() {
	// TODO(rfindley): investigate the broken formatting resulting from these inlinings.
	Ellipsis()
	Ellipsis()
	Ellipsis()
	var _ []any = []any{1, f(), g()}
	Ellipsis()
	func(_ ...any) {
		Ellipsis()
	}(h())
	var _ []any = i()
	Ellipsis()
}

func f() int
func g() int
func h() (int, int)
func i() []any
-- ellipsis2/ellipsis2.go --
package ellipsis2

func Ellipsis2(_, _ int, rest ...int) { //@codeaction("_", "_", "refactor.rewrite", ellipsis2, "Refactor: remove unused parameter")
}

func _() {
	Ellipsis2(1,2,3)
	Ellipsis2(h())
	Ellipsis2(1,2, []int{3, 4}...)
}

func h() (int, int)

-- @ellipsis2/ellipsis2/ellipsis2.go --
package ellipsis2

func Ellipsis2(_ int, rest ...int) { //@codeaction("_", "_", "refactor.rewrite", ellipsis2, "Refactor: remove unused parameter")
}

func _() {
	Ellipsis2(2, []int{3}...)
	func(_, blank0 int, rest ...int) {
		Ellipsis2(blank0, rest...)
	}(h())
	Ellipsis2(2, []int{3, 4}...)
}

func h() (int, int)
-- overlapping/overlapping.go --
package overlapping

func Overlapping(i int) int { //@codeactionerr(re"(i) int", re"(i) int", "refactor.rewrite", re"overlapping")
	return 0
}

func _() {
	x := Overlapping(Overlapping(0))
	_ = x
}

-- effects/effects.go --
package effects

func effects(x, y int) int { //@codeaction("y", "y", "refactor.rewrite", effects), diag("y", re"unused")
	return x
}

func f() int
func g() int

func _() {
	effects(f(), g())
	effects(f(), g())
}
-- @effects/effects/effects.go --
package effects

func effects(x int) int { //@codeaction("y", "y", "refactor.rewrite", effects), diag("y", re"unused")
	return x
}

func f() int
func g() int

func _() {
	var x, _ int = f(), g()
	effects(x)
	{
		var x, _ int = f(), g()
		effects(x)
	}
}
-- recursive/recursive.go --
package recursive

func Recursive(x int) int { //@codeaction("x", "x", "refactor.rewrite", recursive)
	return Recursive(1)
}

-- @recursive/recursive/recursive.go --
package recursive

func Recursive() int { //@codeaction("x", "x", "refactor.rewrite", recursive)
	return Recursive()
}