Source file test/inline_unified.go
1 // errorcheckwithauto -0 -m -d=inlfuncswithclosures=1 2 //go:build goexperiment.unified 3 // +build goexperiment.unified 4 5 // Copyright 2022 The Go Authors. All rights reserved. 6 // Use of this source code is governed by a BSD-style 7 // license that can be found in the LICENSE file. 8 9 package foo 10 11 func r(z int) int { 12 foo := func(x int) int { // ERROR "can inline r.func1" "func literal does not escape" 13 return x + z 14 } 15 bar := func(x int) int { // ERROR "func literal does not escape" "can inline r.func2" 16 return x + func(y int) int { // ERROR "can inline r.func2.1" "can inline r.func3" 17 return 2*y + x*z 18 }(x) // ERROR "inlining call to r.func2.1" 19 } 20 return foo(42) + bar(42) // ERROR "inlining call to r.func1" "inlining call to r.func2" "inlining call to r.func3" 21 } 22