Skip to content

Fix bug in pvec pop resulting in empty tail - #64

Open
georgematheos wants to merge 5 commits into
JuliaCollections:masterfrom
georgematheos:patch-1
Open

Fix bug in pvec pop resulting in empty tail#64
georgematheos wants to merge 5 commits into
JuliaCollections:masterfrom
georgematheos:patch-1

Conversation

@georgematheos

Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

(just added a test for this behavior)

@codecov-commenter

codecov-commenter commented Aug 13, 2020

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.38%. Comparing base (2dd9b36) to head (2bafd37).
⚠️ Report is 13 commits behind head on master.

Additional details and impacted files
@@            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     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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