Home | History | Annotate | Download | only in test
      1 // errorcheck -0 -m -l=3
      2 
      3 // Copyright 2016 The Go Authors. All rights reserved.
      4 // Use of this source code is governed by a BSD-style
      5 // license that can be found in the LICENSE file.
      6 
      7 // Test more aggressive inlining (-l=3 allows variadic functions)
      8 // See issue #18116.
      9 
     10 package foo
     11 
     12 func head(xs ...string) string { // ERROR "can inline head" "leaking param: xs to result"
     13 	return xs[0]
     14 }
     15 
     16 func f() string { // ERROR "can inline f"
     17 	x := head("hello", "world") // ERROR "inlining call to head" "\[\]string literal does not escape"
     18 	return x
     19 }
     20