| 1 |
package golden |
| 2 |
|
| 3 |
import "a/internal" |
| 4 |
|
| 5 |
// Functions. |
| 6 |
|
| 7 |
func f() { |
| 8 |
One() |
| 9 |
|
| 10 |
new(T).Two() |
| 11 |
} |
| 12 |
|
| 13 |
type T struct{} |
| 14 |
|
| 15 |
//go:fix inline |
| 16 |
func One() int { return one } |
| 17 |
|
| 18 |
const one = 1 |
| 19 |
|
| 20 |
//go:fix inline |
| 21 |
func (T) Two() int { return 2 } |
| 22 |
|
| 23 |
// Constants. |
| 24 |
|
| 25 |
const Uno = 1 |
| 26 |
|
| 27 |
//go:fix inline |
| 28 |
const In1 = Uno // want In1: `goFixInline const "a".Uno` |
| 29 |
|
| 30 |
const ( |
| 31 |
no1 = one |
| 32 |
|
| 33 |
//go:fix inline |
| 34 |
In2 = one // want In2: `goFixInline const "a".one` |
| 35 |
) |
| 36 |
|
| 37 |
//go:fix inline |
| 38 |
const bad1 = 1 // want `invalid //go:fix inline directive: const value is not the name of another constant` |
| 39 |
|
| 40 |
//go:fix inline |
| 41 |
const in5, |
| 42 |
in6, |
| 43 |
bad2 = one, one, |
| 44 |
one + 1 // want `invalid //go:fix inline directive: const value is not the name of another constant` |
| 45 |
|
| 46 |
// Make sure we don't crash on iota consts, but still process the whole decl. |
| 47 |
// |
| 48 |
//go:fix inline |
| 49 |
const ( |
| 50 |
a = iota // want `invalid //go:fix inline directive: const value is iota` |
| 51 |
b |
| 52 |
in7 = one |
| 53 |
) |
| 54 |
|
| 55 |
const ( |
| 56 |
x = 1 |
| 57 |
//go:fix inline |
| 58 |
in8 = x |
| 59 |
) |
| 60 |
|
| 61 |
//go:fix inline |
| 62 |
const a = iota // want `invalid //go:fix inline directive: const value is iota` |
| 63 |
|
| 64 |
//go:fix inline |
| 65 |
type E = map[[Uno]string][]*T // want `invalid //go:fix inline directive: array types not supported` |
| 66 |
|
| 67 |
// literal array lengths are OK |
| 68 |
// |
| 69 |
//go:fix inline |
| 70 |
type EL = map[[2]string][]*T // want EL: `goFixInline alias` |