diff options
| author | Alan Donovan <adonovan@google.com> | 2025-07-18 13:16:21 -0400 |
|---|---|---|
| committer | Alan Donovan <adonovan@google.com> | 2025-07-18 11:13:45 -0700 |
| commit | 34b70684ba2fc8c5cba900e9abdfb874c1bd8c0e (patch) | |
| tree | 193beb57fdcb7df07b64f3cdbd230a1719108125 /src/database/sql/sql.go | |
| parent | 66536242fce34787230c42078a7bbd373ef8dcb0 (diff) | |
| download | go-34b70684ba2fc8c5cba900e9abdfb874c1bd8c0e.tar.xz | |
go/types: infer correct type for y in append(bytes, y...)
The type-checking logic for append has a special case for
append(bytes, s...) where the typeset for s contains string.
However, this case was triggering even when the typeset contained
only []byte, causing the creation of Signature types of the form
func([]byte, Y) []byte, with the variadic flag set, where Y
is the type of Y (e.g. a type parameter constrained to ~[]byte).
This is an illegal combination: a variadic signature's last
parameter must be a slice, or its typeset must contain string.
This caused x/tools/go/ssa to crash.
This CL narrows the special case to only typesets that contain
string, and adds a test for the inferred signature.
(There's little point in testing that a subsequent NewSignatureType
call would succeed, because the inferred type plainly has
no free type parameters.)
Fixes #73871
Change-Id: Id7641104133371dd6b0077f281cdaa9db84cc1c7
Reviewed-on: https://go-review.googlesource.com/c/go/+/688815
Reviewed-by: Mark Freeman <mark@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Diffstat (limited to 'src/database/sql/sql.go')
0 files changed, 0 insertions, 0 deletions
