Skip to content

Commit 05cd886

Browse files
authored
Fix behaviour of set_retained_vns_del! for num_produce == 0 (#1000)
1 parent bd99d4f commit 05cd886

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/varinfo.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1829,19 +1829,19 @@ end
18291829
"""
18301830
set_retained_vns_del!(vi::VarInfo)
18311831
1832-
Set the `"del"` flag of variables in `vi` with `order > num_produce` to `true`.
1832+
Set the `"del"` flag of variables in `vi` with `order > num_produce` to `true`. If
1833+
`num_produce` is `0`, _all_ variables will have their `"del"` flag set to `true`.
18331834
18341835
Will error if `vi` does not have an accumulator for `VariableOrder`.
18351836
"""
18361837
function set_retained_vns_del!(vi::VarInfo)
18371838
if !hasacc(vi, Val(:VariableOrder))
18381839
msg = "`vi` must have an accumulator for VariableOrder to set the `del` flag."
1839-
raise(ArgumentError(msg))
1840+
throw(ArgumentError(msg))
18401841
end
18411842
num_produce = get_num_produce(vi)
18421843
for vn in keys(vi)
1843-
order = getorder(vi, vn)
1844-
if order > num_produce
1844+
if num_produce == 0 || getorder(vi, vn) > num_produce
18451845
set_flag!(vi, vn, "del")
18461846
end
18471847
end

0 commit comments

Comments
 (0)