Skip to content

Commit

Permalink
Record correct assignment line (fixes #399) (#401)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy authored Nov 30, 2019
1 parent c2a119f commit d0efefb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/backedges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ mutable struct SlotDep
end
function SlotDep(i::Int, stmt, slotdeps)
deps = add_deps!(Int[], stmt, slotdeps)
SlotDep(isssa(stmt) ? 0 : i, deps)
SlotDep(i, deps)
end
function add_deps!(linedeps, stmt, slotdeps)
if isssa(stmt)
Expand Down
28 changes: 28 additions & 0 deletions test/backedges.jl
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,32 @@ end
@test !isdefined(BackEdgesTest, :planetdiameters)
@test length(Revise.moduledeps[BackEdgesTest]) == 1
@test Revise.moduledeps[BackEdgesTest][:flag] == Set([(BackEdgesTest, first(Iterators.drop(mexs[BackEdgesTest], 1))[1])])

# issue #399
src = """
for jy in ("j","y"), nu in (0,1)
jynu = Expr(:quote, Symbol(jy,nu))
jynuf = Expr(:quote, Symbol(jy,nu,"f"))
bjynu = Symbol("bessel",jy,nu)
if jy == "y"
@eval begin
\$bjynu(x::Float64) = nan_dom_err(ccall((\$jynu,libm), Float64, (Float64,), x), x)
\$bjynu(x::Float32) = nan_dom_err(ccall((\$jynuf,libm), Float32, (Float32,), x), x)
\$bjynu(x::Float16) = Float16(\$bjynu(Float32(x)))
end
else
@eval begin
\$bjynu(x::Float64) = ccall((\$jynu,libm), Float64, (Float64,), x)
\$bjynu(x::Float32) = ccall((\$jynuf,libm), Float32, (Float32,), x)
\$bjynu(x::Float16) = Float16(\$bjynu(Float32(x)))
end
end
@eval begin
\$bjynu(x::Real) = \$bjynu(float(x))
\$bjynu(x::Complex) = \$(Symbol("bessel",jy))(\$nu,x)
end
end
"""
ex = Meta.parse(src)
@test Revise.methods_by_execution(BackEdgesTest, ex) isa Tuple
end

0 comments on commit d0efefb

Please sign in to comment.