andyferris / Dictionaries.jl

An alternative interface for dictionaries in Julia, for improved productivity and performance
Other
282 stars 28 forks source link

fix same-object copies in `deepcopy` #131

Closed stev47 closed 8 months ago

stev47 commented 8 months ago

Previously same-object references were not copied correctly and the following would fail.

x = Indices()
y = deepcopy((x, x))
@test y[1] === y[2]

In order to not copy the same object multiple times in deepcopy, an IdDict is passed to deepcopy_internal which should be used by implementations. This commit makes use of that dictionary to store already copied objects and fix the above issue.

Also deepcopy_internal on Dictionary was superfluous and was removed along the way.

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (0230039) 80.10% compared to head (a6e6ff2) 80.12%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #131 +/- ## ========================================== + Coverage 80.10% 80.12% +0.02% ========================================== Files 20 20 Lines 2357 2360 +3 ========================================== + Hits 1888 1891 +3 Misses 469 469 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.