]> Cypherpunks repositories - gostls13.git/commit
[release-branch.go1.22] go/types: fix assertion failure when range over int is not...
authorTim King <taking@google.com>
Tue, 9 Jul 2024 21:01:56 +0000 (14:01 -0700)
committerCherry Mui <cherryyz@google.com>
Tue, 16 Jul 2024 18:53:36 +0000 (18:53 +0000)
commit4b27560db937aa104753a96bf011d7f13c4aedc3
tree7d2405c00bd741fa5096654e62f5b19ba541a07b
parent4e548f2c8e489a408033c8aab336077b16bc8cf7
[release-branch.go1.22] 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]==

Fixes #68334
Fixes #68370

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>
(cherry picked from commit 4e77872d16340595d76b905fe24369b76cfd1b5f)
Reviewed-on: https://go-review.googlesource.com/c/go/+/598055
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