]> Cypherpunks repositories - gostls13.git/commit
go/types: relax NewSignatureType for append(slice, str...)
authorAlan Donovan <adonovan@google.com>
Mon, 21 Jul 2025 18:35:08 +0000 (14:35 -0400)
committerAlan Donovan <adonovan@google.com>
Wed, 26 Nov 2025 23:35:27 +0000 (15:35 -0800)
commit0f6397384b583a18bae90421a71b6abad39a437f
tree52287ed20a8b9a332bf30553c56efd6da6effc21
parent992ad55e3dcea4bd017d618d759cb9cd3529f288
go/types: relax NewSignatureType for append(slice, str...)

CL 688815 contained a partial fix for the reported bug, but
NewSignatureType continued to panic. This change relaxes it
to permit construction of the type "func([]byte, B) []byte"
where "type B []byte". We must do so because a client
may instantiate the type "func([]byte, T...)" where [T ~string|~[]byte]
at T=B, and may have no way to know that they are dealing
with this very special edge case of append.

Added a regression test of NewSignatureType, which I should
have done in the earlier CL.

Also, make typestring less pedantic and fragile.

Fixes #73871

Change-Id: I3d8f8609582149f9c9f8402a04ad516c2c63bbc6
Reviewed-on: https://go-review.googlesource.com/c/go/+/689277
TryBot-Bypass: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Mark Freeman <markfreeman@google.com>
src/cmd/compile/internal/types2/signature.go
src/cmd/compile/internal/types2/typestring.go
src/go/types/api_test.go
src/go/types/signature.go
src/go/types/typestring.go