Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/auto/checker.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
28 changes: 28 additions & 0 deletions test/auto_borrow_checker_tests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading