-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[stdlib] Fix dict probing error #2351
Conversation
e22e1cb
to
acc9f13
Compare
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.
Small style changes, looks great, thank you so much!
stdlib/src/collections/dict.mojo
Outdated
var insert_slot = Optional[Int]() | ||
var insert_index = Optional[Int]() |
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.
We can get rid of these definitions too
def test_probing_error(): | ||
var keys = List( | ||
7005684093727295727, | ||
2833576045803927472, | ||
-446534169874157203, | ||
-5597438459201014662, | ||
-7007119737006385570, | ||
7237741981002255125, | ||
-649171104678427962, | ||
-6981562940350531355, | ||
) | ||
var d = Dict[DummyKey, Int]() | ||
for i in range(len(keys)): | ||
d[DummyKey(keys[i])] = i | ||
assert_equal(len(d), len(keys)) | ||
for i in range(len(d)): | ||
var k = keys[i] | ||
assert_equal(i, d[k]) |
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.
🔥
return self.value != other.value | ||
|
||
|
||
def test_probing_error(): |
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.
can you rename this to test_mojo_issue_1729
? that'll help point folks towards the issue context if/when someone trips this later
acc9f13
to
ea4bd84
Compare
Signed-off-by: Maxim Zaks <maxim.zaks@gmail.com>
Signed-off-by: Maxim Zaks <maxim.zaks@gmail.com>
Signed-off-by: Maxim Zaks <maxim.zaks@gmail.com>
Signed-off-by: Maxim Zaks <maxim.zaks@gmail.com>
805e9e6
to
a46eaa4
Compare
✅🟣 This contribution has been merged 🟣✅ Hi @mzaks thank you fixing this bug, great catch! We're moving to a new infrastructure for merging contributions to Mojo (we're using a tool called Copybara), and your contribution has now been merged into our internal copy of the Mojo Standard Library. The changes in this PR will appear here in the mojo repo Thank you so much for the amazing catch 🔍 finding this bug and your 🔥 contribution fixing it :) Please let me know if you have any questions or concerns. |
[External] [stdlib] Fix dict probing error Fixes modularml#1729 Co-authored-by: Maxim Zaks <maxim.zaks@gmail.com> Closes modularml#2351 MODULAR_ORIG_COMMIT_REV_ID: d48102f8ac6ad9cfdd5df57c344ce41d7b5cff4c
Fixes #1729