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: check key values, not get return for haskey(k, orderedrobindict) #858

Merged
merged 5 commits into from
Jun 29, 2023

Conversation

mrufsvold
Copy link
Contributor

Resolves #857

I am not sure if checking if the key appears in the key vector property is the right way to go. Open to another solution!

@mrufsvold
Copy link
Contributor Author

I discovered the same problem in setindex! last night, so I'll push a couple more fixes tomorrow.

@mrufsvold
Copy link
Contributor Author

Okay, I didn't understand the code as well as I should have on my first pass.

I fixed setindex! to use !isequal instead of != in setindex! because the equality check was failing when the existing value is missing.

I also actually fixed the haskey functions. I was misunderstanding the id lookup dict stored inside the OrderedRobinDict.

@oxinabox oxinabox requested a review from eulerkochy June 20, 2023 04:12
Copy link
Member

@eulerkochy eulerkochy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing. LGTM. Minor comment for adding a testset.

@@ -139,6 +139,8 @@
@test h["a","b"] == h[("a","b")] == 4
h["a","b","c"] = 4
@test h["a","b","c"] == h[("a","b","c")] == 4
h["b"] = missing
@test 5 == (h["b"] = 5)
end

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a testset (you can name the testset "Fixes issue 857") corresponding to fixed scenarios that you mentioned here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I rolled back all the changes to the tests and consolidated all the changes under a single testset!

@oxinabox oxinabox merged commit e62f469 into JuliaCollections:master Jun 29, 2023
9 of 10 checks passed
oxinabox pushed a commit that referenced this pull request Jun 29, 2023
…t) (#858)

* fix: check key values, not `get` return for haskey(k, orderedrobindict)

* Fix: use isequal in setindex!

* re-fix: use `get` for `in keys()` but descend to the actual id-dict

* Remove accidental paste in docstring

* consolidate tests for issue under testset

---------

Co-authored-by: Micah Rufsvold <mjrufsvold@mathematica-mpr.com>
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.

Base.in(x, KeySet{OrderedRobinDict}) should not use get
4 participants