Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #16326: use typesof in code_* for all :call expressions #17096

Merged
merged 1 commit into from
Jul 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this kills the branch in 296 completely. The main requirement for fixing #17469 is that the expression goes through the expand step in line 290. However, it's hard to predict the consequences of changes to this function.

# 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