Skip to content

Commit

Permalink
Merge pull request JuliaLang#17096 from ihnorton/fix16326
Browse files Browse the repository at this point in the history
Fix JuliaLang#16326: use typesof in code_* for all :call expressions
  • Loading branch information
ihnorton authored Jul 2, 2016
2 parents 6e7b519 + ec8e52f commit eb05662
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 2 additions & 6 deletions base/docs/utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,8 @@ repl(str::AbstractString) = :(apropos($str))
repl(other) = :(@doc $(esc(other)))

function _repl(x)
docs = :(@doc $(esc(x)))
if isexpr(x, :call)
# Handles function call syntax where each argument is an atom (symbol, number, etc.)
t = Base.gen_call_with_extracted_types(doc, x)
(isexpr(t, :call, 3) && t.args[1] === doc) && (docs = t)
end
docs = (isexpr(x, :call) && !any(isexpr(x, :(::)) for x in x.args)) ?
Base.gen_call_with_extracted_types(doc, x) : :(@doc $(esc(x)))
if isfield(x)
quote
if isa($(esc(x.args[1])), DataType)
Expand Down
3 changes: 2 additions & 1 deletion base/interactiveutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,8 @@ typesof(args...) = Tuple{map(a->(isa(a,Type) ? Type{a} : typeof(a)), args)...}
gen_call_with_extracted_types(fcn, ex0::Symbol) = Expr(:call, fcn, Meta.quot(ex0))
function gen_call_with_extracted_types(fcn, ex0)
if isa(ex0, Expr) &&
any(a->(Meta.isexpr(a, :kw) || Meta.isexpr(a, :parameters)), ex0.args)
(any(a->(Meta.isexpr(a, :kw) || Meta.isexpr(a, :parameters)), ex0.args) ||
ex0.head == :call)
# keyword args not used in dispatch, so just remove them
args = filter(a->!(Meta.isexpr(a, :kw) || Meta.isexpr(a, :parameters)), ex0.args)
return Expr(:call, fcn, esc(args[1]),
Expand Down

0 comments on commit eb05662

Please sign in to comment.