From 76f3e0ac8d094b2bc5f8a3fb8a19d1d17a07fe2c Mon Sep 17 00:00:00 2001 From: Youlin Feng Date: Fri, 1 Nov 2024 11:17:49 +0800 Subject: go/types, types2: print variadic argument in dotdotdot form in error message If a variadic call to a variadic function has not enough/too many arguments, then print the variadic argument in dotdotdot form instead of as a slice type in the error message. Fixes #70150 Change-Id: I81a802619b3b66195b303e2df2bafeb1433ad310 Reviewed-on: https://go-review.googlesource.com/c/go/+/624335 Reviewed-by: Robert Griesemer Reviewed-by: Robert Findley Auto-Submit: Robert Griesemer Auto-Submit: Robert Findley LUCI-TryBot-Result: Go LUCI --- src/cmd/compile/internal/types2/call.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/cmd') diff --git a/src/cmd/compile/internal/types2/call.go b/src/cmd/compile/internal/types2/call.go index 4ff5fe49e7..9095349e1d 100644 --- a/src/cmd/compile/internal/types2/call.go +++ b/src/cmd/compile/internal/types2/call.go @@ -530,7 +530,7 @@ func (check *Checker) arguments(call *syntax.CallExpr, sig *Signature, targs []T } err := check.newError(WrongArgCount) err.addf(at, "%s arguments in call to %s", qualifier, call.Fun) - err.addf(nopos, "have %s", check.typesSummary(operandTypes(args), false)) + err.addf(nopos, "have %s", check.typesSummary(operandTypes(args), ddd)) err.addf(nopos, "want %s", check.typesSummary(varTypes(params), sig.variadic)) err.report() return -- cgit v1.3