From 19105d2c90d71e260cd661236f9c7130af89dcf0 Mon Sep 17 00:00:00 2001 From: Michael Hatherly Date: Wed, 9 Sep 2015 15:08:51 +0200 Subject: [PATCH] Improve invalid doc expression error message. Display the unexpanded form of the expression instead of its expansion. --- base/docs/Docs.jl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/base/docs/Docs.jl b/base/docs/Docs.jl index e5d74059d14f6..5df6a695e7c0d 100644 --- a/base/docs/Docs.jl +++ b/base/docs/Docs.jl @@ -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) && @@ -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