| 1 |
This is a regression test for a bug in the special logic for embedded |
| 2 |
struct fields. It assumed that the lack of ast.Field.Names implied an |
| 3 |
embedded field, but of course that can also happen with parameters |
| 4 |
and results, such as Value in the declaration of func f below. |
| 5 |
|
| 6 |
-- go.mod -- |
| 7 |
module example.com |
| 8 |
go 1.18 |
| 9 |
|
| 10 |
-- a/a.go -- |
| 11 |
package a |
| 12 |
|
| 13 |
type Val int |
| 14 |
|
| 15 |
//go:fix inline |
| 16 |
type Value = Val // want Value:"goFixInline alias" |
| 17 |
|
| 18 |
func f(Value) Value { return 1 } // want "Type alias Value should be inlined" "Type alias Value should be inlined" |
| 19 |
|
| 20 |
var x []Value // want "Type alias Value should be inlined" |
| 21 |
|
| 22 |
-- a/a.go.golden -- |
| 23 |
package a |
| 24 |
|
| 25 |
type Val int |
| 26 |
|
| 27 |
//go:fix inline |
| 28 |
type Value = Val // want Value:"goFixInline alias" |
| 29 |
|
| 30 |
func f(Val) Val { return 1 } // want "Type alias Value should be inlined" "Type alias Value should be inlined" |
| 31 |
|
| 32 |
var x []Val // want "Type alias Value should be inlined" |
| 33 |
|