-
Notifications
You must be signed in to change notification settings - Fork 18k
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/doc: doc.New returns wrong type for constant declaration #16153
Comments
I digged a bit into the code and it seems the problem is (also?) in go/doc/exports.go and the way type propagation is done in filterSpecList.
and defined in in filterSpecList, and I believe this is how we end up with incorrect type information. Do we need that type propagation at all in the doc package for I modified my test package to highlight the fact that the type propagation is not related to integers:
|
Related: #5397. The right fix for this may be to rewrite the entire package to use go/types, now that go/types is in the stdlib. That's a fair amount of work, though. |
Right now, There are certain things that Another point, the package is currently described as |
I agree with Dmitri: this package should not use |
Punting to Go 1.10. Sorry. Any help wanted, though. /cc @griesemer (in case you hadn't seen this one) |
The bug is fairly simple: A previous constant type should only be used if there's no type and no value in a constant declaration. The existing code ignores values. |
Change https://golang.org/cl/68730 mentions this issue: |
doc.New
returns incorrect type information about the constantY
in this program:Test case: https://play.golang.org/p/-2ZQcrQgCM
The cause is this heuristic code in
(*reader).readValue
:Enabling the
doc.AllDecls
mode bit works around the problem in this particular example becausex
is unexported.This bug is the underlying cause of godoc.org issue 409.
golang/gddo#409
The text was updated successfully, but these errors were encountered: