Open bcmills opened 1 year ago
(Found while addressing code review comments on https://go.dev/cl/510315, for #61394.)
go/doc
doesn't use type information produced by the type checker and has various heuristics/approx. mechanisms to get things mostly right. Looks like this is another situation where these mechanisms need to be improved.
Change https://go.dev/cl/528402 mentions this issue: go/doc: add a golden test that reproduces #62640
Change https://go.dev/cl/510315 mentions this issue: go/doc: track struct fields during reading
Moving to Backlog because this is currently stalled awaiting code review.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Extract the following test to a local directory and run it:
What did you expect to see?
The
doc.Package
forexample.go
should not include any methods on typeS
, since the methodF
is shadowed by the fieldS.F
. (For confirmation that the field actually does shadow the method, see https://go.dev/play/p/OdO3BIxNHgd.)What did you see instead?
(CC @griesemer @agnivade)