diff options
| author | Rob Findley <rfindley@anthropic.com> | 2026-04-12 22:27:14 +0000 |
|---|---|---|
| committer | Robert Findley <rfindley@anthropic.com> | 2026-04-14 07:49:47 -0700 |
| commit | 66e8a77e30babe052c023320d85af4c126413da8 (patch) | |
| tree | c82ab9f27b8eefd7e1438a2c76d48832307c9faa /src/encoding/json/encode.go | |
| parent | 3a528855af73ff1e3bd7f5ac8e9374e27f3144f8 (diff) | |
| download | go-66e8a77e30babe052c023320d85af4c126413da8.tar.xz | |
go/types: fix inNode debug assertion for "for range x {}"
For a RangeStmt with no range variables, s.TokPos is invalid (NoPos).
The inNode debug assertion (start <= pos && pos < end) fails on the
zero pos. The position is unused in that case (noNewVarPos is only
read when isDef is true), but inNode still asserts.
Use s.For as a fallback so the assertion holds. types2 is unaffected
because syntax.ForStmt does not have this shape.
Found while running go/types tests with debug=true.
Change-Id: I82ebffca98bc9f41cda4364d31d0845bac97b5ae
Reviewed-on: https://go-review.googlesource.com/c/go/+/766181
Reviewed-by: Robert Griesemer <gri@google.com>
LUCI-TryBot-Result: golang-scoped@luci-project-accounts.iam.gserviceaccount.com <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: David Chase <drchase@google.com>
Diffstat (limited to 'src/encoding/json/encode.go')
0 files changed, 0 insertions, 0 deletions
