]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: fix false positives in isGoConst
authorMatthew Dempsky <mdempsky@google.com>
Thu, 28 Feb 2019 01:12:23 +0000 (17:12 -0800)
committerMatthew Dempsky <mdempsky@google.com>
Thu, 28 Feb 2019 20:31:53 +0000 (20:31 +0000)
commit7fa195c1b9650db3e91b90af6b16405e7e0ba9ce
treea2e51879e17338c8b21cc5c7bd2a9f4c33cd2f0e
parentb47f31f68ce7a00ce9432e656014d72f1e94734e
cmd/compile: fix false positives in isGoConst

isGoConst could spuriously return true for variables that shadow a
constant declaration with the same name.

Because even named constants are always represented by OLITERAL nodes,
the easy fix is to just ignore ONAME nodes in isGoConst. We can
similarly ignore ONONAME nodes.

Confirmed that k8s.io/kubernetes/test/e2e/storage builds again with
this fix.

Fixes #30430.

Change-Id: I899400d749982d341dc248a7cd5a18277c2795ec
Reviewed-on: https://go-review.googlesource.com/c/164319
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Robert Griesemer <gri@golang.org>
src/cmd/compile/internal/gc/const.go
test/fixedbugs/issue30430.go [new file with mode: 0644]