diff options
Diffstat (limited to 'test/inline.go')
| -rw-r--r-- | test/inline.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/inline.go b/test/inline.go index 599d5233e0..d0ebe84aa5 100644 --- a/test/inline.go +++ b/test/inline.go @@ -160,6 +160,19 @@ func switchType(x interface{}) int { // ERROR "can inline switchType" "x does no } } +func inlineRangeIntoMe(data []int) { // ERROR "can inline inlineRangeIntoMe" "data does not escape" + rangeFunc(data, 12) // ERROR "inlining call to rangeFunc" +} + +func rangeFunc(xs []int, b int) int { // ERROR "can inline rangeFunc" "xs does not escape" + for i, x := range xs { + if x == b { + return i + } + } + return -1 +} + type T struct{} func (T) meth(int, int) {} // ERROR "can inline T.meth" |
