]> Cypherpunks repositories - gostls13.git/commit
go/doc: recognize methods on generic types as Funcs
authorKeith Randall <khr@golang.org>
Wed, 9 Nov 2022 23:29:09 +0000 (15:29 -0800)
committerKeith Randall <khr@google.com>
Thu, 10 Nov 2022 06:33:18 +0000 (06:33 +0000)
commita11cd6f69aec5c783656601fbc7b493e0d63f605
tree7215621d0a81f8babf235632aca786f9ab317715
parentc3d444d09852981daa6ed9e0ba65d90c89a7d917
go/doc: recognize methods on generic types as Funcs

When writing markdown for godoc, we can reference a method M of
a type T as [T.M]. This doesn't currently work for methods on generic
types because the declaration of the type parameter gets in the way.
(You'd have to write [T[P].M] and that doesn't parse, and even if it
did you'd have to spell "P" correctly.)

Get rid of the type parameter when building the list of Funcs so
[T.M] works in godoc if T is generic.

Change-Id: I8ef5264124a944967df3ce20ddd40a2447ff4187
Reviewed-on: https://go-review.googlesource.com/c/go/+/449236
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Robert Griesemer <gri@google.com>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/go/doc/comment_test.go
src/go/doc/doc.go
src/go/doc/testdata/pkgdoc/doc.go