| 1 |
This test checks that inlining removes unnecessary interface conversions. |
| 2 |
|
| 3 |
-- main.go -- |
| 4 |
package main |
| 5 |
|
| 6 |
import ( |
| 7 |
"fmt" |
| 8 |
"io" |
| 9 |
) |
| 10 |
|
| 11 |
func _(d discard) { |
| 12 |
g(d) //@codeaction("g", "refactor.inline.call", result=out) |
| 13 |
} |
| 14 |
|
| 15 |
func g(w io.Writer) { fmt.Println(w) } |
| 16 |
|
| 17 |
var _ discard |
| 18 |
type discard struct{} |
| 19 |
func (discard) Write(p []byte) (int, error) { return len(p), nil } |
| 20 |
-- @out/main.go -- |
| 21 |
package main |
| 22 |
|
| 23 |
import ( |
| 24 |
"fmt" |
| 25 |
"io" |
| 26 |
) |
| 27 |
|
| 28 |
func _(d discard) { |
| 29 |
fmt.Println(d) //@codeaction("g", "refactor.inline.call", result=out) |
| 30 |
} |
| 31 |
|
| 32 |
func g(w io.Writer) { fmt.Println(w) } |
| 33 |
|
| 34 |
var _ discard |
| 35 |
type discard struct{} |
| 36 |
func (discard) Write(p []byte) (int, error) { return len(p), nil } |