| Basic tests of inlining by literalization. | |
| recover() is an example of a function with effects, | |
| so it (currently) defeats reduction. But note that the | |
| other parameter of 'add' is eliminated. | |
| -- go.mod -- | |
| module testdata | |
| go 1.12 | |
| -- a/a1.go -- | |
| package a | |
| func _() { | |
| add(recover().(int), 2) //@ inline(re"add", add1) | |
| } | |
| func add(x, y int) int { return x + y } | |
| -- add1 -- | |
| package a | |
| func _() { | |
| func(x int) int { return x + 2 }(recover().(int)) //@ inline(re"add", add1) | |
| } | |
| func add(x, y int) int { return x + y } |