Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! make_zero! for immutable
Browse files Browse the repository at this point in the history
  • Loading branch information
vchuravy committed Oct 10, 2024
1 parent a3def6c commit 0a4f468
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/make_zero.jl
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,8 @@ end
# For make_zero!(NamedTuple) we want to recurse and zero out
# the storage
if !Base.ismutabletype(T)
return make_zero_immutable!(prev, seen)
make_zero_immutable!(prev, seen)
return nothing
end

for i = 1:nf
Expand Down
4 changes: 1 addition & 3 deletions test/abi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -503,11 +503,9 @@ end
rand!(dparams.q)
rand!(dparams.p)

dparams2 = make_zero!(dparams)
make_zero!(dparams)
@test all(==(0), dparams.q)
@test all(==(0), dparams.p)

@test dparams2 == dparams
end


Expand Down

0 comments on commit 0a4f468

Please sign in to comment.