mirror of
https://github.com/golang/go
synced 2024-11-05 20:16:13 -07:00
8a9485c023
Unified IR records the inline nodes position right at the position of the inline call, while the old inliner always records at the position of the original nodes. We want to keep non-unified working up through go 1.20, thus this CL extract the inline test case that is different in Unified IR and the old inliner. Updates #53058 Change-Id: I14b0ee99fe797d34f27cfec068982790c64ac263 Reviewed-on: https://go-review.googlesource.com/c/go/+/411935 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com> Auto-Submit: Cuong Manh Le <cuong.manhle.vn@gmail.com> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
22 lines
775 B
Go
22 lines
775 B
Go
// errorcheckwithauto -0 -m -d=inlfuncswithclosures=1
|
|
//go:build !goexperiment.unified
|
|
// +build !goexperiment.unified
|
|
|
|
// Copyright 2022 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package foo
|
|
|
|
func r(z int) int {
|
|
foo := func(x int) int { // ERROR "can inline r.func1" "func literal does not escape"
|
|
return x + z
|
|
}
|
|
bar := func(x int) int { // ERROR "func literal does not escape" "can inline r.func2"
|
|
return x + func(y int) int { // ERROR "can inline r.func2.1" "can inline r.func3"
|
|
return 2*y + x*z
|
|
}(x) // ERROR "inlining call to r.func2.1"
|
|
}
|
|
return foo(42) + bar(42) // ERROR "inlining call to r.func1" "inlining call to r.func2" "inlining call to r.func3"
|
|
}
|