Skip to content

Commit 63b3dd9

Browse files
authored
Fix a Core.Box (#114)
This is presumably a Julia limitation, but it seems that inner functions get inferred as `Core.Box` if they call themselves. We can work around it by splitting it out. Specifically, in Cthulhu one sees for p in preds terminal_preds!::Core.Box(s, p, edges, covered) end when this is an inner function.
1 parent f111efe commit 63b3dd9

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

src/codeedges.jl

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -543,26 +543,27 @@ function postprint_lineedges(io::IO, idx::Int, edges::CodeEdges, bbchanged::Bool
543543
end
544544

545545
function terminal_preds(i::Int, edges::CodeEdges)
546-
function terminal_preds!(s, j, edges, covered)
547-
j covered && return s
548-
push!(covered, j)
549-
preds = edges.preds[j]
550-
if isempty(preds)
551-
push!(s, j)
552-
else
553-
for p in preds
554-
terminal_preds!(s, p, edges, covered)
555-
end
556-
end
557-
return s
558-
end
559546
s, covered = BitSet(), BitSet()
560547
push!(covered, i)
561548
for p in edges.preds[i]
562549
terminal_preds!(s, p, edges, covered)
563550
end
564551
return s
565552
end
553+
function terminal_preds!(s, j, edges, covered) # can't be an inner function because it calls itself (Core.Box)
554+
j covered && return s
555+
push!(covered, j)
556+
preds = edges.preds[j]
557+
if isempty(preds)
558+
push!(s, j)
559+
else
560+
for p in preds
561+
terminal_preds!(s, p, edges, covered)
562+
end
563+
end
564+
return s
565+
end
566+
566567

567568
"""
568569
isrequired = lines_required(obj::GlobalRef, src::CodeInfo, edges::CodeEdges)

0 commit comments

Comments
 (0)