]> Cypherpunks repositories - gostls13.git/commit
go/types: fix iota undefined after ConstDecl inside function in ConstSpec
authorCuong Manh Le <cuong.manhle.vn@gmail.com>
Wed, 11 Sep 2019 08:51:28 +0000 (15:51 +0700)
committerRobert Griesemer <gri@golang.org>
Thu, 12 Sep 2019 04:15:00 +0000 (04:15 +0000)
commit88076ebc92e793fa95db314c0defed5571d8ce99
tree4e0c86c4ec4c54c5da557d69079f1640a1144725
parent0b739fd4df6be871edcc17dd7832142a50a6f80e
go/types: fix iota undefined after ConstDecl inside function in ConstSpec

When reaching const declaration, Checker override context iota to use
correct iota value, but does not restore the old value when exit, and
always set context iota to nil. It ends up with undefined iota after
const declaration.

To fix it, preserve the original iota value and restore it after const
declaration.

Fixes #34228

Change-Id: I42d5efb55a57e5ddc369bb72d31f1f039c92361c
Reviewed-on: https://go-review.googlesource.com/c/go/+/194737
Run-TryBot: Cuong Manh Le <cuong.manhle.vn@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/go/types/decl.go
src/go/types/testdata/const0.src