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

HashMap.getOrPutAssumeCapacityAdapted should set key to undefined #9138

Merged
merged 2 commits into from
Jun 18, 2021

Conversation

Hadron67
Copy link
Contributor

As the doc comment states, this method sets the key and value to undefined if no existing entry was found and the caller should then initialize the key and value. But it looks like the new key was mistakenly set to the adapted key passed into this method, which will cause a compile error if its type is different from the real key.

@LemonBoy
Copy link
Contributor

Needs a test.

@Hadron67
Copy link
Contributor Author

Done :)

@Vexu Vexu merged commit 1f29b75 into ziglang:master Jun 18, 2021
@Hadron67 Hadron67 deleted the std-hm-gopca branch June 18, 2021 05:59
andrewrk pushed a commit that referenced this pull request Jun 20, 2021
)

* std.hash_map.HashMap: getOrPutAssumeCapacityAdapted should set key to undefined

* add test for std.hash_map.HashMap.getOrPutAdapted
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.

3 participants