| 1 |
This test exercises behavior of change signature refactoring with respect to |
| 2 |
comments. |
| 3 |
|
| 4 |
Currently, inline comments around arguments or parameters are dropped, which is |
| 5 |
probably acceptable. Fixing this is likely intractible without fixing comment |
| 6 |
representation in the AST. |
| 7 |
|
| 8 |
-- go.mod -- |
| 9 |
module unused.mod |
| 10 |
|
| 11 |
go 1.18 |
| 12 |
|
| 13 |
-- a/a.go -- |
| 14 |
package a |
| 15 |
|
| 16 |
// A doc comment. |
| 17 |
func A(x /* used parameter */, unused int /* unused parameter */ ) int { //@codeaction("unused", "refactor.rewrite.removeUnusedParam", result=a) |
| 18 |
// about to return |
| 19 |
return x // returning |
| 20 |
// just returned |
| 21 |
} |
| 22 |
|
| 23 |
// This function makes calls. |
| 24 |
func _() { |
| 25 |
// about to call |
| 26 |
A(one() /* used arg */, 2 /* unused arg */) // calling |
| 27 |
// just called |
| 28 |
} |
| 29 |
|
| 30 |
func one() int { |
| 31 |
// I should be unaffected! |
| 32 |
return 1 |
| 33 |
} |
| 34 |
|
| 35 |
-- @a/a/a.go -- |
| 36 |
package a |
| 37 |
|
| 38 |
// A doc comment. |
| 39 |
func A(x int) int { //@codeaction("unused", "refactor.rewrite.removeUnusedParam", result=a) |
| 40 |
// about to return |
| 41 |
return x // returning |
| 42 |
// just returned |
| 43 |
} |
| 44 |
|
| 45 |
// This function makes calls. |
| 46 |
func _() { |
| 47 |
// about to call |
| 48 |
A(one()) // calling |
| 49 |
// just called |
| 50 |
} |
| 51 |
|
| 52 |
func one() int { |
| 53 |
// I should be unaffected! |
| 54 |
return 1 |
| 55 |
} |