mirror of
https://github.com/golang/go
synced 2024-11-26 15:56:57 -07:00
7fa195c1b9
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>
18 lines
341 B
Go
18 lines
341 B
Go
// compile
|
|
|
|
// Copyright 2019 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
// Issue 30430: isGoConst returned true for non-const variables,
|
|
// resulting in ICE.
|
|
|
|
package p
|
|
|
|
func f() {
|
|
var s string
|
|
_ = map[string]string{s: ""}
|
|
}
|
|
|
|
const s = ""
|