Skip to content

Commit 26e4377

Browse files
committed
Revert "cmd/vet: teach vet about ast.AliasSpec"
This reverts commit aa8c8e7. Reason: Decision to back out current alias implementation. For #16339. Change-Id: I4db9a8d6b3625c794be9d2f1ff0e9c047f383d28 Reviewed-on: https://go-review.googlesource.com/32827 Run-TryBot: Robert Griesemer <[email protected]> TryBot-Result: Gobot Gobot <[email protected]> Reviewed-by: Chris Manghane <[email protected]>
1 parent 8e97053 commit 26e4377

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

src/cmd/vet/copylock.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,7 @@ func checkCopyLocksGenDecl(f *File, gd *ast.GenDecl) {
6161
return
6262
}
6363
for _, spec := range gd.Specs {
64-
valueSpec, ok := spec.(*ast.ValueSpec)
65-
if !ok {
66-
continue
67-
}
64+
valueSpec := spec.(*ast.ValueSpec)
6865
for i, x := range valueSpec.Values {
6966
if path := lockPathRhs(f, x); path != nil {
7067
f.Badf(x.Pos(), "variable declaration copies lock value to %v: %v", valueSpec.Names[i].Name, path)

src/cmd/vet/shadow.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ func checkShadowDecl(f *File, d *ast.GenDecl) {
188188
for _, spec := range d.Specs {
189189
valueSpec, ok := spec.(*ast.ValueSpec)
190190
if !ok {
191-
continue
191+
f.Badf(spec.Pos(), "invalid AST: var GenDecl not ValueSpec")
192+
return
192193
}
193194
// Don't complain about deliberate redeclarations of the form
194195
// var i = i

src/cmd/vet/testdata/copylock.go

-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package testdata
22

33
import (
4-
"runtime"
54
"sync"
65
"sync/atomic"
76
)
@@ -157,11 +156,3 @@ func AtomicTypesCheck() {
157156
vP := &vX
158157
vZ := &atomic.Value{}
159158
}
160-
161-
// ensure we don't crash when we encounter aliases; issue 17755
162-
163-
var _ => runtime.MemProfileRate
164-
165-
const _ => runtime.Compiler
166-
167-
type _ => sync.Mutex

0 commit comments

Comments
 (0)