-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Closed
Labels
docsystemThe documentation building systemThe documentation building system
Description
On Julia master (so the conditional below evaluates as true).
This works:
julia> module MyMod
"""
A docstring
"""
macro mymac(ex)
return esc(ex)
end
end
Main.MyMod
help?> MyMod.@mymac
A docstring
But it doesn't if we put it inside a conditional expression (e.g., dependent on the Julia version):
julia> module MyMod
if VERSION >= v"1.2.0"
"""
A docstring
"""
macro mymac(ex)
return esc(ex)
end
end
end
WARNING: replacing module MyMod.
Main.MyMod
help?> MyMod.@mymac
No documentation found.
Main.MyMod.@mymac is a macro.
# 1 method for macro "@mymac":
[1] @mymac(__source__::LineNumberNode, __module__::Module, ex) in Main.MyMod at REPL[3]:8However we can fix it with the post-hoc @doc mechanism:
julia> module MyMod
if VERSION >= v"1.2.0"
macro mymac(ex)
return esc(ex)
end
@doc "A docstring" :(MyMod.@mymac)
end
end
WARNING: replacing module MyMod.
Main.MyMod
help?> MyMod.@mymac
A docstring
Metadata
Metadata
Assignees
Labels
docsystemThe documentation building systemThe documentation building system