-
Notifications
You must be signed in to change notification settings - Fork 63
Bug in PersistentMap equals implementation #218
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
Conversation
… this case we still need to do a promotion if needed
…n case of partial collision` test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One of the causes of all these problems is that some time ago the decision was made to abstain from canonicalizing the map builder due to an issue with iteration (#73).
Could you please check if there are any other problems left after that and if there are parts that could be simplified now?
I have fixed iteration issue in #217 and wrote tests to check it, so now I am completely confident in the correctness of how iterators work while maintaining the tree invariant. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for fixing it!
In case of repeated mutable key removal in
mutableReplaceNode
, the same node may be passed astargetNode
andnewNode
(due to the owner match in themutableCollisionRemoveEntryAtIndex
method). However, if this node contains only one value and is not the root, we need to promote it to the top. This check and promotion happen in theupdateNodeAtIndex
method, so even if the references are equal, this method must be called. However, if promotion is not needed, no extra allocation will be performed, since the nodes have the sameowner
.