Skip to content
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

Invalid docstring metadata with call syntax + where or return type annotation #45174

Open
mortenpi opened this issue May 3, 2022 · 0 comments
Labels
docsystem The documentation building system

Comments

@mortenpi
Copy link
Contributor

mortenpi commented May 3, 2022

The following module

module Docerr
struct TestStruct1 end
struct TestStruct2 end
struct TestStruct3 end

"standard"
(baz::TestStruct1)(a::Int) = 0

"parametric"
(foo::TestStruct2)(a::T) where T = 0

"return"
(bar::TestStruct3)(a::Int, b::Int) :: Int = 0
end

leads to the following docstring metadata:

julia> Docs.meta(Docerr)
IdDict{Any, Any} with 3 entries:
  Main.Docerr.TestStruct1 => MultiDoc(Type[Tuple{Int64}], IdDict{Any, Any}(Tuple{Int64}=>DocStr(svec("standard"), nothing, Dict{Symbol, Any}(:typesig=>Tuple{Int64}, :module=>Main.Docerr, :linenumber=>6, :binding=…
  Main.Docerr.foo         => MultiDoc(Type[Tuple{T} where T], IdDict{Any, Any}(Tuple{T} where T=>DocStr(svec("parametric"), nothing, Dict{Symbol, Any}(:typesig=>Tuple{T} where T, :module=>Main.Docerr, :linenumber…
  Main.Docerr.bar         => MultiDoc(Type[Tuple{Int64, Int64}], IdDict{Any, Any}(Tuple{Int64, Int64}=>DocStr(svec("return"), nothing, Dict{Symbol, Any}(:typesig=>Tuple{Int64, Int64}, :module=>Main.Docerr, :linen…

In other words, when using the call syntax with either parametric types or a return type, the docstring gets attached to a "binding" named after the arbitrary variable name in the call syntax. You can actually pull up the docstring via Docerr.foo in the REPL help, even though that makes no sense.

@mortenpi mortenpi added the docsystem The documentation building system label May 3, 2022
@mortenpi mortenpi changed the title Invalid docstring metadata with call syntax + where / type annotation Invalid docstring metadata with call syntax + where or return type annotation May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docsystem The documentation building system
Projects
None yet
Development

No branches or pull requests

1 participant