mirror of
https://github.com/golang/go.git
synced 2026-01-29 15:12:08 +03:00
[dev.typeparams] cmd/compile: simplify inlining variadic calls
We already have and use FixVariadicCall to normalize non-dotted calls to variadic functions elsewhere in the compiler to simplify rewriting of function calls. This CL updates inl.go to use it too. A couple tests need to be updated to (correctly) expect diagnostics about "... argument" instead of a slice literal. This is because inl.go previously failed to set Implicit on the slice literal node. Change-Id: I76bd79b95ae1f16e3b26ff7e9e1c468f538fd1f0 Reviewed-on: https://go-review.googlesource.com/c/go/+/323009 Trust: Matthew Dempsky <mdempsky@google.com> Trust: Dan Scales <danscales@google.com> Run-TryBot: Matthew Dempsky <mdempsky@google.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Dan Scales <danscales@google.com>
This commit is contained in:
@@ -14,6 +14,6 @@ func head(xs ...string) string { // ERROR "can inline head" "leaking param: xs t
|
||||
}
|
||||
|
||||
func f() string { // ERROR "can inline f"
|
||||
x := head("hello", "world") // ERROR "inlining call to head" "\[\]string{...} does not escape"
|
||||
x := head("hello", "world") // ERROR "inlining call to head" "\.\.\. argument does not escape"
|
||||
return x
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user