Fixes #17755
Change-Id: I1ad1edc382b1312d992963054eb82648cb5112d2
Reviewed-on: https://go-review.googlesource.com/32588
Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Russ Cox <rsc@golang.org>
return
}
for _, spec := range gd.Specs {
- valueSpec := spec.(*ast.ValueSpec)
+ valueSpec, ok := spec.(*ast.ValueSpec)
+ if !ok {
+ continue
+ }
for i, x := range valueSpec.Values {
if path := lockPathRhs(f, x); path != nil {
f.Badf(x.Pos(), "variable declaration copies lock value to %v: %v", valueSpec.Names[i].Name, path)
for _, spec := range d.Specs {
valueSpec, ok := spec.(*ast.ValueSpec)
if !ok {
- f.Badf(spec.Pos(), "invalid AST: var GenDecl not ValueSpec")
- return
+ continue
}
// Don't complain about deliberate redeclarations of the form
// var i = i
package testdata
import (
+ "runtime"
"sync"
"sync/atomic"
)
vP := &vX
vZ := &atomic.Value{}
}
+
+// ensure we don't crash when we encounter aliases; issue 17755
+
+var _ => runtime.MemProfileRate
+
+const _ => runtime.Compiler
+
+type _ => sync.Mutex