]> Cypherpunks repositories - gostls13.git/commitdiff
Revert "cmd/vet: teach vet about ast.AliasSpec"
authorRobert Griesemer <gri@golang.org>
Sat, 5 Nov 2016 00:01:34 +0000 (17:01 -0700)
committerRobert Griesemer <gri@golang.org>
Sat, 5 Nov 2016 00:18:05 +0000 (00:18 +0000)
This reverts commit aa8c8e770e6db895405b66d38867c2368d94024a.

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 <gri@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Chris Manghane <cmang@golang.org>
src/cmd/vet/copylock.go
src/cmd/vet/shadow.go
src/cmd/vet/testdata/copylock.go

index e8f94fc685672d1deee2a9cb05339d6695cf2a40..31c1257a47017401a53811c7d874608bf85f0de2 100644 (file)
@@ -61,10 +61,7 @@ func checkCopyLocksGenDecl(f *File, gd *ast.GenDecl) {
                return
        }
        for _, spec := range gd.Specs {
-               valueSpec, ok := spec.(*ast.ValueSpec)
-               if !ok {
-                       continue
-               }
+               valueSpec := spec.(*ast.ValueSpec)
                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)
index 764129d94cb10de9fe6e9ba2f6d944b3daa3a8c9..29c952fd8858eae7fb8a4d1747d7798e141e8444 100644 (file)
@@ -188,7 +188,8 @@ func checkShadowDecl(f *File, d *ast.GenDecl) {
        for _, spec := range d.Specs {
                valueSpec, ok := spec.(*ast.ValueSpec)
                if !ok {
-                       continue
+                       f.Badf(spec.Pos(), "invalid AST: var GenDecl not ValueSpec")
+                       return
                }
                // Don't complain about deliberate redeclarations of the form
                //      var i = i
index 52ac29c47c51f93b09460f1ce2e2fff231c6f31e..35ed766f1da7e26010bcd7d3285c534c5ebf8b83 100644 (file)
@@ -1,7 +1,6 @@
 package testdata
 
 import (
-       "runtime"
        "sync"
        "sync/atomic"
 )
@@ -157,11 +156,3 @@ func AtomicTypesCheck() {
        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