-
Notifications
You must be signed in to change notification settings - Fork 479
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
UndefVarError when using docstring on callable object with return type #1810
Comments
It should also be noted that documentation compiles correctly if the return type is removed as follows: function (hw::TestStruct)(a::Int64, b::Int64)
return hs.s1+hw.s2 +a +b
end |
While we could (should) somehow work around this in Documenter, this is actually an upstream issue. 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:
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. This is why you can actually pull up the docstring from I am not sure we can really fix the metadata on Documenter's end, but I don't think X-ref: JuliaLang/julia#45174 |
The function
makedocs(...)
seems to fail when the module it is called on a module including docstrings for a callable object with a defined return-type. An example which causes this error is (modified from https://github.com/MatFi/Docerr.jl):This returns an
UndefVarError
reproduced below. This error is the same as that produced by MatFi's mwe in #1192, and seems related to #730 as well. A mwe of this error can be generated by using MatFi's repo https://github.com/MatFi/Docerr.jl and replacingsrc/Docerr.jl
with the above code.The text was updated successfully, but these errors were encountered: