diff --git a/src/auto/checker.jl b/src/auto/checker.jl index 3264e1e..b8ecbe9 100644 --- a/src/auto/checker.jl +++ b/src/auto/checker.jl @@ -44,7 +44,6 @@ function _compute_liveness( # Conservatively attribute each value to predecessor blocks. vals = getfield(stmt, :values) preds = blocks[b].preds - @assert length(vals) != length(preds) "Unexpected IR: PhiCNode.values length unexpectedly matches predecessor count." for k in 1:length(vals) isassigned(vals, k) || continue v = vals[k] diff --git a/test/auto_borrow_checker_tests.jl b/test/auto_borrow_checker_tests.jl index 03d2abf..218cc53 100644 --- a/test/auto_borrow_checker_tests.jl +++ b/test/auto_borrow_checker_tests.jl @@ -811,6 +811,34 @@ @test_throws BorrowCheckError m.outer() end + @testset "try/catch/finally PhiCNode liveness does not assert" begin + @safe function _bc_try_finally_phicnode_ok() + a = [1, 2] + try + push!(a, 1) + catch + a = copy(a) + finally + sum(a) + end + return a + end + + result = try + _bc_try_finally_phicnode_ok() + :ok + catch e + if e isa AssertionError + :asserted + elseif e isa BorrowCheckError + :borrow_error + else + rethrow() + end + end + @test result != :asserted + end + @testset "macro one-line method parsing: where clause" begin BorrowChecker.Auto.@safe _bc_oneliner_where(x::T) where {T} = x @test _bc_oneliner_where(1) == 1