Skip to content

Commit 7f924a7

Browse files
authored
avoid a (arguably benign) Core.Box and test package is empty of such boxes (#143)
1 parent fa8b676 commit 7f924a7

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

src/codeedges.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -793,10 +793,10 @@ end
793793
#
794794
# [Wei84]: M. Weiser, "Program Slicing," IEEE Transactions on Software Engineering, 10, pages 352-357, July 1984.
795795
function add_control_flow!(isrequired, src::CodeInfo, cfg::CFG, postdomtree)
796-
local changed::Bool = false
796+
changed = Ref(false)
797797
function mark_isrequired!(idx::Int)
798798
if !isrequired[idx]
799-
changed |= isrequired[idx] = true
799+
changed[] |= isrequired[idx] = true
800800
return true
801801
end
802802
return false
@@ -818,7 +818,7 @@ function add_control_flow!(isrequired, src::CodeInfo, cfg::CFG, postdomtree)
818818
end
819819
end
820820
end
821-
return changed
821+
return changed[]
822822
end
823823

824824
is_conditional_terminator(@nospecialize stmt) = stmt isa GotoIfNot ||

test/runtests.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1-
using Test
1+
using Test, LoweredCodeUtils
22

33
# using LoweredCodeUtils
44
# @testset "Ambiguity" begin
55
# @test isempty(detect_ambiguities(LoweredCodeUtils, LoweredCodeUtils.JuliaInterpreter, Base, Core))
66
# end
77

8+
if isdefined(Test, :detect_closure_boxes)
9+
@test isempty(Test.detect_closure_boxes(LoweredCodeUtils))
10+
end
11+
812
@testset "LoweredCodeUtils.jl" begin
913
@testset "signatures.jl" include("signatures.jl")
1014
@testset "codeedges.jl" include("codeedges.jl")

0 commit comments

Comments
 (0)