You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
synenka opened this issue
Jan 20, 2022
· 2 comments
Labels
NeedsFixThe path to resolution is known, but the work has not been done.ToolsThis label describes issues relating to any tools in the x/tools repository.
I created a generic function F with type parameter "T" and a separate struct called “T”.
Then I run cmd/godoc to view it’s documentation.
Steps to reproduce:
mkdir /tmp/test
cd /tmp/test
go mod init test
echo 'package test; func F[T any](t T) {}; type T struct{}' > test.go
go install golang.org/x/tools/cmd/godoc@latest
godoc
# In browser navigate to localhost:6060/pkg/test
What did you expect to see?
Documentation of generic func F with type param “T” used in parameter list. Type “T” doesn’t link anywhere.
What did you see instead?
Type parameter “T” is rendered with a hyper-link that links to incorrect type (struct "T").
This should not happen as struct “T” and type parameter “T” are different entities.
The text was updated successfully, but these errors were encountered:
gopherbot
added
the
Tools
This label describes issues relating to any tools in the x/tools repository.
label
Jan 20, 2022
LinkifyText should not generate links to global declarations for
identifiers that are type parameters.
Because the syntactic resolver does not record the declaration for type
parameters declared in the method receiver (see
https://golang.org/issue/50956) a name lookup is used as a workaround.
This is fine here because it is only applied to undeclared indentifiers
and LinkifyText is only ever called on a single declaration at a time,
not on a full AST.
Updates golang/go#50717
Change-Id: I32f2203ce80c060ee18ca8b964a2d5fd80f41957
Reviewed-on: https://go-review.googlesource.com/c/tools/+/382714
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Peter Weinberger <pjw@google.com>
LinkifyText should not generate links to global declarations for
identifiers that are type parameters.
Because the syntactic resolver does not record the declaration for type
parameters declared in the method receiver (see
https://golang.org/issue/50956) a name lookup is used as a workaround.
This is fine here because it is only applied to undeclared indentifiers
and LinkifyText is only ever called on a single declaration at a time,
not on a full AST.
Updates golang/go#50717
Change-Id: I32f2203ce80c060ee18ca8b964a2d5fd80f41957
Reviewed-on: https://go-review.googlesource.com/c/tools/+/382714
Reviewed-by: Robert Findley <rfindley@google.com>
Run-TryBot: Alessandro Arzilli <alessandro.arzilli@gmail.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Trust: Peter Weinberger <pjw@google.com>
NeedsFixThe path to resolution is known, but the work has not been done.ToolsThis label describes issues relating to any tools in the x/tools repository.
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?
I created a generic function F with type parameter "T" and a separate struct called “T”.
Then I run cmd/godoc to view it’s documentation.
Steps to reproduce:
What did you expect to see?
Documentation of generic func F with type param “T” used in parameter list. Type “T” doesn’t link anywhere.
What did you see instead?
Type parameter “T” is rendered with a hyper-link that links to incorrect type (struct "T").

This should not happen as struct “T” and type parameter “T” are different entities.
The text was updated successfully, but these errors were encountered: