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 9, 2015
1 parent 01a4e32 commit 1a237f5
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 @@ -439,6 +439,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 @@ -463,7 +469,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 1a237f5

Please sign in to comment.