For instance, I have the following test in golang:
// inline-tests.go
package inlinetests
func plus(a, b int) int {
return a + b
}
func plus_plus(a, b, c int) int {
return plus(plus(a, b), plus(b, c))
}
func plus_iter(l ...int) (res int) {
for _, v := range l {
res += v
}
return
}
If I try to build it, I receive the following:
go build -gcflags=-m inline-tests.go
# command-line-arguments
./inline-tests.go:4: can inline plus
./inline-tests.go:8: can inline plus_plus
./inline-tests.go:9: inlining call to plus
./inline-tests.go:9: inlining call to plus
./inline-tests.go:9: inlining call to plus
./inline-tests.go:12: plus_iter l does not escape
Is there any way to let compiler inline plus_iter
? If yes, is there any way to inline map iteration?