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