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
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 <[email protected]>
Reviewed-by: Robert Griesemer <[email protected]>
Run-TryBot: Keith Randall <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
input="[T] and [U] are types, and [T.M] is a method, but [V] is a broken link. [rand.Int] and [crand.Reader] are things.\n"
28
-
wantHTML=`<p><a href="#T">T</a> and <a href="#U">U</a> are types, and <a href="#T.M">T.M</a> is a method, but [V] is a broken link. <a href="/math/rand#Int">rand.Int</a> and <a href="/crypto/rand#Reader">crand.Reader</a> are things.`+"\n"
29
-
wantOldHTML="<p>[T] and [U] are <i>types</i>, and [T.M] is a method, but [V] is a broken link. [rand.Int] and [crand.Reader] are things.\n"
30
-
wantMarkdown="[T](#T) and [U](#U) are types, and [T.M](#T.M) is a method, but \\[V] is a broken link. [rand.Int](/math/rand#Int) and [crand.Reader](/crypto/rand#Reader) are things.\n"
31
-
wantText="T and U are types, and T.M is a method, but [V] is a broken link. rand.Int and\ncrand.Reader are things.\n"
32
-
wantOldText="[T] and [U] are types, and [T.M] is a method, but [V] is a broken link.\n[rand.Int] and [crand.Reader] are things.\n"
27
+
input="[T] and [U] are types, and [T.M] is a method, but [V] is a broken link. [rand.Int] and [crand.Reader] are things. [G.M1] and [G.M2] are generic methods.\n"
28
+
wantHTML=`<p><a href="#T">T</a> and <a href="#U">U</a> are types, and <a href="#T.M">T.M</a> is a method, but [V] is a broken link. <a href="/math/rand#Int">rand.Int</a> and <a href="/crypto/rand#Reader">crand.Reader</a> are things. <a href="#G.M1">G.M1</a> and <a href="#G.M2">G.M2</a> are generic methods.`+"\n"
29
+
wantOldHTML="<p>[T] and [U] are <i>types</i>, and [T.M] is a method, but [V] is a broken link. [rand.Int] and [crand.Reader] are things. [G.M1] and [G.M2] are generic methods.\n"
30
+
wantMarkdown="[T](#T) and [U](#U) are types, and [T.M](#T.M) is a method, but \\[V] is a broken link. [rand.Int](/math/rand#Int) and [crand.Reader](/crypto/rand#Reader) are things. [G.M1](#G.M1) and [G.M2](#G.M2) are generic methods.\n"
31
+
wantText="T and U are types, and T.M is a method, but [V] is a broken link. rand.Int and\ncrand.Reader are things. G.M1 and G.M2 are generic methods.\n"
32
+
wantOldText="[T] and [U] are types, and [T.M] is a method, but [V] is a broken link.\n[rand.Int] and [crand.Reader] are things. [G.M1] and [G.M2] are generic methods.\n"
33
33
wantSynopsis="T and U are types, and T.M is a method, but [V] is a broken link."
34
34
wantOldSynopsis="[T] and [U] are types, and [T.M] is a method, but [V] is a broken link."
0 commit comments