Skip to content

Commit 25caf8c

Browse files
JeffBezansonstaticfloat
authored andcommitted
fix #39426, at-which not working with .. function (#39446)
(cherry picked from commit 927c24f)
1 parent be03ff0 commit 25caf8c

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

stdlib/InteractiveUtils/src/macros.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function gen_call_with_extracted_types(__module__, fcn, ex0, kws=Expr[])
4242
insert!(args, (isnothing(i) ? 2 : i+1), ex0.args[2])
4343
ex0 = Expr(:call, args...)
4444
end
45-
if ex0.head === :. || (ex0.head === :call && string(ex0.args[1])[1] == '.')
45+
if ex0.head === :. || (ex0.head === :call && ex0.args[1] !== :.. && string(ex0.args[1])[1] == '.')
4646
codemacro = startswith(string(fcn), "code_")
4747
if codemacro && ex0.args[2] isa Expr
4848
# Manually wrap a dot call in a function

stdlib/InteractiveUtils/test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,10 @@ const curmod_str = curmod === Main ? "Main" : join(curmod_name, ".")
252252
@test (@which Int[1; 2]).name === :typed_vcat
253253
@test (@which [1 2;3 4]).name === :hvcat
254254
@test (@which Int[1 2;3 4]).name === :typed_hvcat
255+
# issue #39426
256+
let x..y = 0
257+
@test (@which 1..2).name === :..
258+
end
255259

256260
# issue #13464
257261
try

stdlib/Test/src/Test.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,7 @@ function _inferred(ex, mod, allow = :(Union{}))
14041404
end
14051405
Meta.isexpr(ex, :call)|| error("@inferred requires a call expression")
14061406
farg = ex.args[1]
1407-
if isa(farg, Symbol) && first(string(farg)) == '.'
1407+
if isa(farg, Symbol) && farg !== :.. && first(string(farg)) == '.'
14081408
farg = Symbol(string(farg)[2:end])
14091409
ex = Expr(:call, GlobalRef(Test, :_materialize_broadcasted),
14101410
farg, ex.args[2:end]...)

0 commit comments

Comments
 (0)