Skip to content

Commit

Permalink
fix JuliaLang#39426, at-which not working with .. function (JuliaLa…
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson authored and antoine-levitt committed May 9, 2021
1 parent 138f824 commit ec818fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stdlib/InteractiveUtils/src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function gen_call_with_extracted_types(__module__, fcn, ex0, kws=Expr[])
insert!(args, (isnothing(i) ? 2 : i+1), ex0.args[2])
ex0 = Expr(:call, args...)
end
if ex0.head === :. || (ex0.head === :call && string(ex0.args[1])[1] == '.')
if ex0.head === :. || (ex0.head === :call && ex0.args[1] !== :.. && string(ex0.args[1])[1] == '.')
codemacro = startswith(string(fcn), "code_")
if codemacro && ex0.args[2] isa Expr
# Manually wrap a dot call in a function
Expand Down
4 changes: 4 additions & 0 deletions stdlib/InteractiveUtils/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,10 @@ const curmod_str = curmod === Main ? "Main" : join(curmod_name, ".")
@test (@which Int[1; 2]).name === :typed_vcat
@test (@which [1 2;3 4]).name === :hvcat
@test (@which Int[1 2;3 4]).name === :typed_hvcat
# issue #39426
let x..y = 0
@test (@which 1..2).name === :..
end

# issue #13464
try
Expand Down
2 changes: 1 addition & 1 deletion stdlib/Test/src/Test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ function _inferred(ex, mod, allow = :(Union{}))
end
Meta.isexpr(ex, :call)|| error("@inferred requires a call expression")
farg = ex.args[1]
if isa(farg, Symbol) && first(string(farg)) == '.'
if isa(farg, Symbol) && farg !== :.. && first(string(farg)) == '.'
farg = Symbol(string(farg)[2:end])
ex = Expr(:call, GlobalRef(Test, :_materialize_broadcasted),
farg, ex.args[2:end]...)
Expand Down

0 comments on commit ec818fd

Please sign in to comment.