Skip to content

Commit

Permalink
Fix introspection macros on simple dot symbol call (JuliaLang#45894)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liozou authored and Francesco Fucci committed Aug 11, 2022
1 parent 4fcb823 commit 5719685
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stdlib/InteractiveUtils/src/macros.jl
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function gen_call_with_extracted_types(__module__, fcn, ex0, kws=Expr[])
end
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
if codemacro && (ex0.head === :call || ex0.args[2] isa Expr)
# Manually wrap a dot call in a function
args = Any[]
ex, i = recursive_dotcalls!(copy(ex0), args)
Expand Down
7 changes: 7 additions & 0 deletions stdlib/InteractiveUtils/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,13 @@ a14637 = A14637(0)
@test (@code_typed max.(Ref(true).x))[2] == Bool
@test !isempty(@code_typed optimize=false max.(Ref.([5, 6])...))

# Issue # 45889
@test !isempty(@code_typed 3 .+ 6)
@test !isempty(@code_typed 3 .+ 6 .+ 7)
@test !isempty(@code_typed optimize=false (.- [3,4]))
@test !isempty(@code_typed optimize=false (6 .- [3,4]))
@test !isempty(@code_typed optimize=false (.- 0.5))

# Issue #36261
@test (@code_typed max.(1 .+ 3, 5 - 7))[2] == Int
f36261(x,y) = 3x + 4y
Expand Down

0 comments on commit 5719685

Please sign in to comment.