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
|
This test exercises the refactoring of putting arguments, return values, and composite literal elements into a
single line.
-- go.mod --
module unused.mod
go 1.18
-- func_arg/func_arg.go --
package func_arg
func A(
a string,
b, c int64,
x int /*@codeaction("x", "x", "refactor.rewrite", func_arg)*/,
y int,
) (r1 string, r2, r3 int64, r4 int, r5 int) {
return a, b, c, x, y
}
-- @func_arg/func_arg/func_arg.go --
package func_arg
func A(a string, b, c int64, x int /*@codeaction("x", "x", "refactor.rewrite", func_arg)*/, y int) (r1 string, r2, r3 int64, r4 int, r5 int) {
return a, b, c, x, y
}
-- func_ret/func_ret.go --
package func_ret
func A(a string, b, c int64, x int, y int) (
r1 string /*@codeaction("r1", "r1", "refactor.rewrite", func_ret)*/,
r2, r3 int64,
r4 int,
r5 int,
) {
return a, b, c, x, y
}
-- @func_ret/func_ret/func_ret.go --
package func_ret
func A(a string, b, c int64, x int, y int) (r1 string /*@codeaction("r1", "r1", "refactor.rewrite", func_ret)*/, r2, r3 int64, r4 int, r5 int) {
return a, b, c, x, y
}
-- functype_arg/functype_arg.go --
package functype_arg
type A func(
a string,
b, c int64,
x int /*@codeaction("x", "x", "refactor.rewrite", functype_arg)*/,
y int,
) (r1 string, r2, r3 int64, r4 int, r5 int)
-- @functype_arg/functype_arg/functype_arg.go --
package functype_arg
type A func(a string, b, c int64, x int /*@codeaction("x", "x", "refactor.rewrite", functype_arg)*/, y int) (r1 string, r2, r3 int64, r4 int, r5 int)
-- functype_ret/functype_ret.go --
package functype_ret
type A func(a string, b, c int64, x int, y int) (
r1 string /*@codeaction("r1", "r1", "refactor.rewrite", functype_ret)*/,
r2, r3 int64,
r4 int,
r5 int,
)
-- @functype_ret/functype_ret/functype_ret.go --
package functype_ret
type A func(a string, b, c int64, x int, y int) (r1 string /*@codeaction("r1", "r1", "refactor.rewrite", functype_ret)*/, r2, r3 int64, r4 int, r5 int)
-- func_call/func_call.go --
package func_call
import "fmt"
func a() {
fmt.Println(
1 /*@codeaction("1", "1", "refactor.rewrite", func_call)*/,
2,
3,
fmt.Sprintf("hello %d", 4),
)
}
-- @func_call/func_call/func_call.go --
package func_call
import "fmt"
func a() {
fmt.Println(1 /*@codeaction("1", "1", "refactor.rewrite", func_call)*/, 2, 3, fmt.Sprintf("hello %d", 4))
}
-- indent/indent.go --
package indent
import "fmt"
func a() {
fmt.Println(
1,
2,
3,
fmt.Sprintf(
"hello %d" /*@codeaction("hello", "hello", "refactor.rewrite", indent, "Join arguments into one line")*/,
4,
))
}
-- @indent/indent/indent.go --
package indent
import "fmt"
func a() {
fmt.Println(
1,
2,
3,
fmt.Sprintf("hello %d" /*@codeaction("hello", "hello", "refactor.rewrite", indent, "Join arguments into one line")*/, 4))
}
-- structelts/structelts.go --
package structelts
type A struct{
a int
b int
}
func a() {
_ = A{
a: 1,
b: 2 /*@codeaction("b", "b", "refactor.rewrite", structelts)*/,
}
}
-- @structelts/structelts/structelts.go --
package structelts
type A struct{
a int
b int
}
func a() {
_ = A{a: 1, b: 2 /*@codeaction("b", "b", "refactor.rewrite", structelts)*/}
}
-- sliceelts/sliceelts.go --
package sliceelts
func a() {
_ = []int{
1 /*@codeaction("1", "1", "refactor.rewrite", sliceelts)*/,
2,
}
}
-- @sliceelts/sliceelts/sliceelts.go --
package sliceelts
func a() {
_ = []int{1 /*@codeaction("1", "1", "refactor.rewrite", sliceelts)*/, 2}
}
-- mapelts/mapelts.go --
package mapelts
func a() {
_ = map[string]int{
"a": 1 /*@codeaction("1", "1", "refactor.rewrite", mapelts)*/,
"b": 2,
}
}
-- @mapelts/mapelts/mapelts.go --
package mapelts
func a() {
_ = map[string]int{"a": 1 /*@codeaction("1", "1", "refactor.rewrite", mapelts)*/, "b": 2}
}
-- starcomment/starcomment.go --
package starcomment
func A(
/*1*/ x /*2*/ string /*3*/ /*@codeaction("x", "x", "refactor.rewrite", starcomment)*/,
/*4*/ y /*5*/ int /*6*/,
) (string, int) {
return x, y
}
-- @starcomment/starcomment/starcomment.go --
package starcomment
func A(/*1*/ x /*2*/ string /*3*/ /*@codeaction("x", "x", "refactor.rewrite", starcomment)*/, /*4*/ y /*5*/ int /*6*/) (string, int) {
return x, y
}
|