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 diff --git a/src/go/types/call.go b/src/go/types/call.go index bb7d0bd0d3..459e927f7e 100644 --- a/src/go/types/call.go +++ b/src/go/types/call.go @@ -530,7 +530,7 @@ func (check *Checker) arguments(call *ast.CallExpr, sig *Signature, targs []Type } err := check.newError(WrongArgCount) err.addf(at, "%s arguments in call to %s", qualifier, call.Fun) - err.addf(noposn, "have %s", check.typesSummary(operandTypes(args), false)) + err.addf(noposn, "have %s", check.typesSummary(operandTypes(args), ddd)) err.addf(noposn, "want %s", check.typesSummary(varTypes(params), sig.variadic)) err.report() return diff --git a/src/internal/types/testdata/fixedbugs/issue70150.go b/src/internal/types/testdata/fixedbugs/issue70150.go new file mode 100644 index 0000000000..ea308cfddb --- /dev/null +++ b/src/internal/types/testdata/fixedbugs/issue70150.go @@ -0,0 +1,15 @@ +// Copyright 2024 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 p + +func _() { + var values []int + vf(values /* ERROR "(variable of type []int) as string value" */) + vf(values...) /* ERROR "have (...int)" */ + vf("ab", "cd", values /* ERROR "have (string, string, ...int)" */ ...) +} + +func vf(method string, values ...int) { +}