Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

go/ast: doc about Object.Data is stale #18631

Closed
motemen opened this issue Jan 12, 2017 · 1 comment
Closed

go/ast: doc about Object.Data is stale #18631

motemen opened this issue Jan 12, 2017 · 1 comment

Comments

@motemen
Copy link
Contributor

motemen commented Jan 12, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

go version go1.7.4 darwin/amd64

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/motemen/dev/go:/Users/motemen/dev"
GORACE=""
GOROOT="/usr/local/Cellar/go/1.7.4_2/libexec"
GOTOOLDIR="/usr/local/Cellar/go/1.7.4_2/libexec/pkg/tool/darwin_amd64"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/zf/x09xcy657yxdlzdwvn627ht00000gn/T/go-build812110392=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"

What did you do?

go doc go/ast Object

What did you expect to see?

An up-to-date doc about ast.Object.Data.

It seems that:

  • If obj.Kind == Pkg, obj.Data is an *ast.Scope.
  • If obj.Kind == Con, obj.Data is always int which is iota for the respective declaration.
  • If obj.Kind == Typ, obj.Data is not used.

The behavior seems to have diverged from the doc at https://codereview.appspot.com/7058060 and https://codereview.appspot.com/7096048 .

What did you see instead?

Document saying:

    The Data fields contains object-specific data:

    Kind    Data type         Data value
    Pkg *types.Package    package scope
    Con     int               iota for the respective declaration
    Con     != nil            constant value
    Typ     *Scope            (used as method scope during type checking - transient)
@gopherbot
Copy link

CL https://golang.org/cl/35075 mentions this issue.

@bradfitz bradfitz added this to the Go1.9 milestone Jan 12, 2017
@golang golang locked and limited conversation to collaborators Jan 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants