summaryrefslogtreecommitdiff
path: root/test/inline_variadic.go
Commit message (Collapse)AuthorAgeFilesLines
* [dev.typeparams] cmd/compile: simplify inlining variadic callsMatthew Dempsky2021-05-261-1/+1
| | | | | | | | | | | | | | | | | | 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>
* cmd/compile: use clearer error message for stuct literalCuong Manh Le2020-09-121-1/+1
| | | | | | | | | | | | | This CL changes "T literal.M" error message to "T{...}.M". It's clearer expression and focusing user on actual issue. Updates #38745 Change-Id: I84b455a86742f37e0bde5bf390aa02984eecc3c9 Reviewed-on: https://go-review.googlesource.com/c/go/+/253677 Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
* cmd/compile: enable inlining variadic functionsMatthew Dempsky2018-03-131-2/+2
| | | | | | | | | As a side effect of working on mid-stack inlining, we've fixed support for inlining variadic functions. Might as well enable it. Change-Id: I7f555f8b941969791db7eb598c0b49f6dc0820aa Reviewed-on: https://go-review.googlesource.com/100456 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
* cmd/compile: generate code that type checks when inlining variadic functionsDavid Lazar2016-11-301-0/+19
This fixes a bug in -l=3 or higher. To inline a variadic function, the compiler generates code that constructs a slice of arguments for the variadic parameter. Consider the function func Foo(xs ...string) and the call Foo("hello", "world"). To inline the call to Foo, the compiler used to generate xs := [2]string{"hello", "world"}[:] which doesn't type check: invalid operation [2]string literal[:] (slice of unaddressable value). Now, the compiler generates xs := []string{"hello", "world"} which does type check. Fixes #18116. Change-Id: I0ee531ef2e6cc276db6fb12602b25a46d6d5db21 Reviewed-on: https://go-review.googlesource.com/33671 Reviewed-by: Keith Randall <khr@golang.org>