Skip to content

Commit

Permalink
Improve invalid doc expression error message.
Browse files Browse the repository at this point in the history
Display the unexpanded form of the expression instead of its expansion.
  • Loading branch information
MichaelHatherly committed Sep 10, 2015
1 parent ced6482 commit 19105d2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion base/docs/Docs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,12 @@ __doc__!(meta, def) = false
fexpr(ex) = isexpr(ex, :function, :stagedfunction, :(=)) && isexpr(ex.args[1], :call)

function docm(meta, def, define = true)

err = (
"invalid doc expression:", def, isexpr(def, :macrocall) ?
"'$(def.args[1])' is not documentable. See 'help?> Docs.@__doc__' for details." : ""
)

def′ = unblock(def)

isexpr(def′, :quote) && isexpr(def′.args[1], :macrocall) &&
Expand All @@ -545,7 +551,7 @@ function docm(meta, def, define = true)
isvar(def′) ? objdoc(meta, def′) :
isexpr(def′, :tuple) ? multidoc(meta, def′.args) :
__doc__!(meta, def′) ? esc(def′) :
isa(def′, Expr) ? error("invalid doc expression $def′") :
isa(def′, Expr) ? error(strip(join(err, "\n\n"))) :
objdoc(meta, def′)
end

Expand Down

0 comments on commit 19105d2

Please sign in to comment.