[go] go/types, types2: handle unconstrained type parameters correctly in a few places

0 views
Skip to first unread message

Gopher Robot (Gerrit)

unread,
Mar 17, 2026, 4:47:10 PM (yesterday) Mar 17
to Robert Griesemer, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Go LUCI, Mark Freeman, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
go/types, types2: handle unconstrained type parameters correctly in a few places

When iterating over a type set via a range clause, am unconstrained
type set produces a single (nil, nil) result. This was not properly
accounted for in a few places:

- In the code for the append and copy built-in, handle the (nil, nil)
case.
- Likewise, in NewSignatureType, panic with the correct (string) error
in this case.

Check all remaining places where we iterate over type sets with range
for correctness.

Fixes #78163.
Change-Id: If0f33f43dad59b4b5ef4c310f80522c25c6e251f
Reviewed-by: Robert Griesemer <g...@google.com>
Reviewed-by: Mark Freeman <markf...@google.com>
Auto-Submit: Robert Griesemer <g...@google.com>
Files:
  • M src/cmd/compile/internal/types2/builtins.go
  • M src/cmd/compile/internal/types2/issues_test.go
  • M src/cmd/compile/internal/types2/signature.go
  • M src/cmd/compile/internal/types2/under.go
  • M src/go/types/builtins.go
  • M src/go/types/issues_test.go
  • M src/go/types/signature.go
  • M src/go/types/under.go
  • A src/internal/types/testdata/fixedbugs/issue78163.go
Change size: S
Delta: 9 files changed, 37 insertions(+), 12 deletions(-)
Branch: refs/heads/master
Submit Requirements:
  • requirement satisfiedCode-Review: +2 by Mark Freeman, +1 by Robert Griesemer
  • requirement satisfiedTryBots-Pass: LUCI-TryBot-Result+1 by Go LUCI
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: go
Gerrit-Branch: master
Gerrit-Change-Id: If0f33f43dad59b4b5ef4c310f80522c25c6e251f
Gerrit-Change-Number: 755941
Gerrit-PatchSet: 4
Gerrit-Owner: Robert Griesemer <g...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
Gerrit-Reviewer: Mark Freeman <markf...@google.com>
Gerrit-Reviewer: Robert Griesemer <g...@google.com>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages