]> Cypherpunks repositories - gostls13.git/commit
go/types: fix assertion failure when range over int is not permitted
authorTim King <taking@google.com>
Tue, 9 Jul 2024 21:01:56 +0000 (14:01 -0700)
committerTim King <taking@google.com>
Fri, 12 Jul 2024 18:39:52 +0000 (18:39 +0000)
commit4e77872d16340595d76b905fe24369b76cfd1b5f
tree080a390d397483b6dcbf39eb794e07e54c6107de
parent8bc32ab6b11a4428f8f0d0eec8db02d520ce422f
go/types: fix assertion failure when range over int is not permitted

Fixes an assertion failure in Checker.rangeStmt that range over int
only has a key type and no value type. When allowVersion failed,
rangeKeyVal returns Typ[Invalid] for the value instead of nil. When
Config.Error != nil, rangeStmt proceeded. The check for rhs[1]==nil
was not enough to catch this case. It must also check rhs[1]==

Updates #68334

Change-Id: Iffa1b2f7b6a94570ec50b8c6603e727a45ba3357
Reviewed-on: https://go-review.googlesource.com/c/go/+/597356
Reviewed-by: Robert Findley <rfindley@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
src/cmd/compile/internal/types2/issues_test.go
src/cmd/compile/internal/types2/stmt.go
src/go/types/issues_test.go
src/go/types/stmt.go