Fix #394 with the missing keys after sorting #395
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is my attempt at fixing #394.
Using
idx = ht_keyindex2(d, key)
oridx = ht_keyindex(d, key, true)
fixes the problem with the key vanishing,
but causes problems with out of bounds errors.
I tried a few other things.
Then I took a look at how
rehash!
worked,and saw that it rebuilds the
slots
based onlykeys
andvalues
(if nothing has been deleted since lastrehash!
)And so I figured: Just correct the
keys
andvalues
and thenrehash
it.I have also created a Julia0.6 branch with this change.
https://github.com/JuliaCollections/DataStructures.jl/tree/julia0.6
What I should have done is created a 0.6 branch without this change then PRed that.
So if this PR gets rejected cos it is wrong, that branch should be deleted.
Otherwise, that branch should be used to tag
v0.8.4
@timholy this does not need to be ported to OrderedCollections.jl (I tried without looking by just
stash apply
ing the change set, and was informed that) OrderedCollections.jl is missing sorting functionality and that corresponding file.I think that file should be moved over.
But that can be done with this change applied.