-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/doc: does not generate docs for generic functions that return []T #48485
Comments
With the suggested change, is the result that the generic function isn't considered a constructor, and is thus rendered as a regular top-level function? That seems fine to me - if it returns a generic slice type, it's not like we can attach it to any specific type. Want to send a PR? It should include a test. |
@mvdan yup, they are rendered as regular top-level functions I submitted a PR, is this test case ok..? |
Change https://golang.org/cl/352389 mentions this issue: |
Thanks! I've left you a review on Gerrit. See https://github.com/golang/go/wiki/GerritBot. |
Duplicate of #49477, which was fixed. |
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
)?linux amd64
What did you do?
I wrote a generic function(inside package), run
gotip doc -all -c -u [package-name]
What did you expect to see?
expect to see the function signature in output, like
func Intersection[T comparable](slices... []T) []T
What did you see instead?
functions that return
[]T
are not printed, others likefunc Some[T any](slice []T, pred func(T) bool) bool
are printedI tried dig into the doc generator, found that
factory functions of T
, their associations gotyp.funcs.set
branch instead ofr.funcs.set
cleanupTypes()
deleted T from r.types because it has no definitiondocPkg.Types
, thus no results are printedwith following
immature hackdiff those functions will be printed:The text was updated successfully, but these errors were encountered: