aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCuong Manh Le <cuong.manhle.vn@gmail.com>2021-06-29 10:11:31 +0700
committerCuong Manh Le <cuong.manhle.vn@gmail.com>2021-06-29 04:38:12 +0000
commitfd4b587da3f9a2bde193a5b9fd2ba96667e08f2d (patch)
treeb0b03165d51185dc962d9d99defd41c4a3a151ae /test
parente2e05af6e189131162b533184eb04de5d597d544 (diff)
downloadgo-fd4b587da3f9a2bde193a5b9fd2ba96667e08f2d.tar.gz
go-fd4b587da3f9a2bde193a5b9fd2ba96667e08f2d.zip
cmd/compile: suppress details error for invalid variadic argument type
CL 255241 made error message involving variadic calls clearer. To do it, we added a check that the type of variadic argument must be a slice. That's why the compiler crashes for invalid variadic argument type. Instead, we can just omit the details error message, and report not enough arguments error, which matches the behavior of go/types and types2. Fixes #46957 Change-Id: I638d7e8f031f0ee344d5d802104fd93a60aae00a Reviewed-on: https://go-review.googlesource.com/c/go/+/331569 Trust: Cuong Manh Le <cuong.manhle.vn@gmail.com> Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com> TryBot-Result: Go Bot <gobot@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Diffstat (limited to 'test')
-rw-r--r--test/fixedbugs/issue46957.go13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/fixedbugs/issue46957.go b/test/fixedbugs/issue46957.go
new file mode 100644
index 0000000000..f3ed3c3def
--- /dev/null
+++ b/test/fixedbugs/issue46957.go
@@ -0,0 +1,13 @@
+// errorcheck
+
+// Copyright 2021 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 main
+
+func f(a int, b ...int) {}
+
+func main() {
+ f(nil...) // ERROR "not enough arguments in call to f$"
+}