Skip to content

Commit 927c24f

Browse files
authored
fix #39426, at-which not working with .. function (#39446)
1 parent ca2332e commit 927c24f

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
@@ -253,6 +253,10 @@ const curmod_str = curmod === Main ? "Main" : join(curmod_name, ".")
253253
@test (@which Int[1; 2]).name === :typed_vcat
254254
@test (@which [1 2;3 4]).name === :hvcat
255255
@test (@which Int[1 2;3 4]).name === :typed_hvcat
256+
# issue #39426
257+
let x..y = 0
258+
@test (@which 1..2).name === :..
259+
end
256260

257261
# issue #13464
258262
try

stdlib/Test/src/Test.jl

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

0 commit comments

Comments
 (0)