Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug in pvec pop resulting in empty tail #64

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

georgematheos
Copy link
Contributor

When calling pop on a persistent vector with, eg., 33 elements, we have a tail of length 1. After this pop call, there was a bug where the resulting pvec had a tail of length 0 rather than a tail of length 32. This causes errors, for instance when calling iterate, which expects a nonempty tail. This PR fixes the behavior by adding a branch in pop function for when the tail length is currently 1 (in which case we make the new tail be pop(trie)).

When calling `pop` on a persistent vector with, eg., 33 elements, we have a `tail` of length 1.  After this `pop` call, there was a bug where the resulting pvec had a tail of length `0` rather than a tail of length `32`.  This causes errors, for instance when calling `iterate`, which expects a nonempty tail.  This PR fixes the behavior by adding a branch in `pop` function for when the tail length is currently `1` (in which case we make the new tail be `pop(trie)`).
Update PersistentVectorTest.jl
@georgematheos
Copy link
Contributor Author

(just added a test for this behavior)

@codecov-commenter
Copy link

codecov-commenter commented Aug 13, 2020

Codecov Report

Merging #64 into master will increase coverage by 1.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #64      +/-   ##
==========================================
+ Coverage   77.30%   78.38%   +1.07%     
==========================================
  Files           7        7              
  Lines         379      384       +5     
==========================================
+ Hits          293      301       +8     
+ Misses         86       83       -3     
Impacted Files Coverage Δ
src/PersistentVector.jl 76.62% <100.00%> (+3.01%) ⬆️
src/BitmappedVectorTrie.jl 72.81% <0.00%> (+1.94%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2dd9b36...2bafd37. Read the comment docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants