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
This happens whether the function is @generated, or defined with if @generated ... method.
julia> using DocStringExtensions
julia> begin
"""
$TYPEDSIGNATURES
example
"""
@generated function example(x)
:(return x)
end
end
example
help?> example
search: example
ERROR: BoundsError: attempt to access Core.SimpleVector at index [2]
Stacktrace:
[1] getindex
@ ./essentials.jl:697 [inlined]
[2] may_invoke_generator(method::Method, atype::Any, sparams::Core.SimpleVector)
@ Base ./reflection.jl:1166
[3] func_for_method_checked
@ ./reflection.jl:1188 [inlined]
[4] return_types(f::Any, types::Any; world::UInt64, interp::Core.Compiler.NativeInterpreter)
@ Base ./reflection.jl:1415
[5] return_types
@ ./reflection.jl:1398 [inlined]
[6] printmethod(buffer::IOBuffer, binding::Base.Docs.Binding, func::Function, method::Method, typesig::Type)
@ DocStringExtensions ~/.julia/packages/DocStringExtensions/JVu77/src/utilities.jl:363
[7] format(#unused#::DocStringExtensions.TypedMethodSignatures, buf::IOBuffer, doc::Base.Docs.DocStr)
@ DocStringExtensions ~/.julia/packages/DocStringExtensions/JVu77/src/abbreviations.jl:398
[8] formatdoc(buf::IOBuffer, doc::Base.Docs.DocStr, part::DocStringExtensions.TypedMethodSignatures)
@ DocStringExtensions ~/.julia/packages/DocStringExtensions/JVu77/src/abbreviations.jl:25
[9] formatdoc(d::Base.Docs.DocStr)
@ REPL /Applications/Julia-1.9.2.app/Contents/Resources/julia/share/julia/stdlib/v1.9/REPL/src/docview.jl:88
[10] parsedoc(d::Base.Docs.DocStr)
@ REPL /Applications/Julia-1.9.2.app/Contents/Resources/julia/share/julia/stdlib/v1.9/REPL/src/docview.jl:96
[11] map!(f::typeof(Base.Docs.parsedoc), dest::Vector{Any}, A::Vector{Base.Docs.DocStr})
@ Base ./abstractarray.jl:3254
[12] mapany(f::Function, A::Vector{Base.Docs.DocStr})
@ Base ./abstractarray.jl:3263
[13] doc(binding::Base.Docs.Binding, sig::Type)
@ REPL /Applications/Julia-1.9.2.app/Contents/Resources/julia/share/julia/stdlib/v1.9/REPL/src/docview.jl:193
[14] doc(binding::Base.Docs.Binding)
@ REPL /Applications/Julia-1.9.2.app/Contents/Resources/julia/share/julia/stdlib/v1.9/REPL/src/docview.jl:160
[15] top-level scope
@ /Applications/Julia-1.9.2.app/Contents/Resources/julia/share/julia/stdlib/v1.9/REPL/src/docview.jl:481
SIGNATURES is fine:
julia> begin
"""
$SIGNATURES
example
"""
@generated function example(x)
:(return x)
end
end
example
help?> example
search: example
example(x)
example
In my real example, this is happening because I have a template which splices $TYPEDSIGNATURES for all methods. I would indeed like to show the type annotation of the generated function if possible.
The text was updated successfully, but these errors were encountered:
Looks like this is failing in Base.return_types. What happens if you instead of documenting the generated function directly wrap it in an "outer" function like so:
This happens whether the function is
@generated
, or defined withif @generated ...
method.SIGNATURES is fine:
In my real example, this is happening because I have a template which splices
$TYPEDSIGNATURES
for all methods. I would indeed like to show the type annotation of the generated function if possible.The text was updated successfully, but these errors were encountered: