Skip to content

Commit

Permalink
Fix bug on introspection macros on broadcasting syntax (#36267)
Browse files Browse the repository at this point in the history
  • Loading branch information
Liozou committed Jun 16, 2020
1 parent 1558e76 commit dd76c0e
Show file tree
Hide file tree
Showing 2 changed files with 10 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 @@ -15,7 +15,7 @@ function recursive_dotcalls!(ex, args, i=1)
if !(ex isa Expr) || ((ex.head !== :. || !(ex.args[2] isa Expr)) &&
(ex.head !== :call || string(ex.args[1])[1] != '.'))
newarg = Symbol('x', i)
if ex.head === :...
if Meta.isexpr(ex, :...)
push!(args, only(ex.args))
return Expr(:..., newarg), i+1
else
Expand Down
9 changes: 9 additions & 0 deletions stdlib/InteractiveUtils/test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,15 @@ B33163(x) = x
@test (@code_typed max.(Ref(true).x))[2] == Bool
@test !isempty(@code_typed optimize=false max.(Ref.([5, 6])...))

# Issue #36261
@test (@code_typed max.(1 .+ 3, 5 - 7))[2] == Int
f36261(x,y) = 3x + 4y
A36261 = Float64[1.0, 2.0, 3.0]
@test (@code_typed f36261.(A36261, pi))[1].inferred
@test (@code_typed f36261.(A36261, 1 .+ pi))[1].inferred
@test (@code_typed f36261.(A36261, 1 + pi))[1].inferred


module ReflectionTest
using Test, Random, InteractiveUtils

Expand Down

0 comments on commit dd76c0e

Please sign in to comment.