Skip to content

Commit cd0c985

Browse files
authored
Improve inference for several methods leading to (:) (#421)
1 parent 227bd4b commit cd0c985

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

src/interpret.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ function inplace_lookup!(ex, i, frame)
296296
if isa(a, SSAValue) || isa(a, SlotNumber)
297297
ex.args[i] = lookup_var(frame, a)
298298
elseif isexpr(a, :call)
299-
for j = 1:length(a.args)
299+
for j = 1:length((a::Expr).args)
300300
inplace_lookup!(a, j, frame)
301301
end
302302
end
@@ -458,7 +458,7 @@ function step_expr!(@nospecialize(recurse), frame, @nospecialize(node), istoplev
458458
rhs = node.args[1]
459459
push!(data.exception_frames, rhs)
460460
elseif node.head === :leave
461-
for _ = 1:node.args[1]
461+
for _ = 1:node.args[1]::Int
462462
pop!(data.exception_frames)
463463
end
464464
elseif node.head === :pop_exception

src/optimize.jl

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,19 +421,21 @@ function reverse_lookup_globalref!(list)
421421
# This only handles the function in calls
422422
for (i, stmt) in enumerate(list)
423423
if isexpr(stmt, :(=))
424-
stmt = stmt.args[2]
424+
stmt = (stmt::Expr).args[2]
425425
end
426426
if isexpr(stmt, :call)
427+
stmt = stmt::Expr
427428
f = stmt.args[1]
428429
if isa(f, QuoteNode)
429430
f = f.value
430431
if isa(f, Function) && !isa(f, Core.IntrinsicFunction)
431432
ft = typeof(f)
432-
name = String(ft.name.name)
433+
tn = ft.name::Core.TypeName
434+
name = String(tn.name)
433435
if startswith(name, '#')
434436
name = name[2:end]
435437
end
436-
stmt.args[1] = GlobalRef(ft.name.module, Symbol(name))
438+
stmt.args[1] = GlobalRef(tn.module, Symbol(name))
437439
end
438440
end
439441
end

src/utils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,8 @@ function lineoffset(framecode::FrameCode)
294294
return offset
295295
end
296296

297-
getline(ln) = Int(isexpr(ln, :line) ? ln.args[1] : ln.line)
298-
getfile(ln) = CodeTracking.maybe_fixup_stdlib_path(String(isexpr(ln, :line) ? ln.args[2] : ln.file))
297+
getline(ln) = Int(isexpr(ln, :line) ? ln.args[1] : ln.line)::Int
298+
getfile(ln) = CodeTracking.maybe_fixup_stdlib_path(String(isexpr(ln, :line) ? ln.args[2] : ln.file)::String)
299299

300300
"""
301301
loc = whereis(frame, pc=frame.pc)

0 commit comments

Comments
 (0)