| 1 |
This test checks basic functionality for renaming (=changing) a function |
| 2 |
signature. |
| 3 |
|
| 4 |
-- go.mod -- |
| 5 |
module example.com |
| 6 |
|
| 7 |
go 1.20 |
| 8 |
|
| 9 |
-- a/a.go -- |
| 10 |
package a |
| 11 |
|
| 12 |
//@rename(Foo, "func(i int, s string)", unchanged) |
| 13 |
//@rename(Foo, "func(s string, i int)", reverse) |
| 14 |
//@rename(Foo, "func(s string)", dropi) |
| 15 |
//@rename(Foo, "func(i int)", drops) |
| 16 |
//@rename(Foo, "func()", dropboth) |
| 17 |
//@renameerr(Foo, "func(i int, s string, t bool)", "not yet supported") |
| 18 |
//@renameerr(Foo, "func(i string)", "not yet supported") |
| 19 |
//@renameerr(Foo, "func(i int, s string) int", "not yet supported") |
| 20 |
|
| 21 |
func Foo(i int, s string) { //@loc(Foo, "func") |
| 22 |
} |
| 23 |
|
| 24 |
func _() { |
| 25 |
Foo(0, "hi") |
| 26 |
} |
| 27 |
-- @dropboth/a/a.go -- |
| 28 |
@@ -12 +12 @@ |
| 29 |
-func Foo(i int, s string) { //@loc(Foo, "func") |
| 30 |
+func Foo() { //@loc(Foo, "func") |
| 31 |
@@ -16 +16 @@ |
| 32 |
- Foo(0, "hi") |
| 33 |
+ Foo() |
| 34 |
-- @dropi/a/a.go -- |
| 35 |
@@ -12 +12 @@ |
| 36 |
-func Foo(i int, s string) { //@loc(Foo, "func") |
| 37 |
+func Foo(s string) { //@loc(Foo, "func") |
| 38 |
@@ -16 +16 @@ |
| 39 |
- Foo(0, "hi") |
| 40 |
+ Foo("hi") |
| 41 |
-- @drops/a/a.go -- |
| 42 |
@@ -12 +12 @@ |
| 43 |
-func Foo(i int, s string) { //@loc(Foo, "func") |
| 44 |
+func Foo(i int) { //@loc(Foo, "func") |
| 45 |
@@ -16 +16 @@ |
| 46 |
- Foo(0, "hi") |
| 47 |
+ Foo(0) |
| 48 |
-- @reverse/a/a.go -- |
| 49 |
@@ -12 +12 @@ |
| 50 |
-func Foo(i int, s string) { //@loc(Foo, "func") |
| 51 |
+func Foo(s string, i int) { //@loc(Foo, "func") |
| 52 |
@@ -16 +16 @@ |
| 53 |
- Foo(0, "hi") |
| 54 |
+ Foo("hi", 0) |
| 55 |
-- @unchanged/a/a.go -- |