Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix issue with OrderedMap, OrderedSet and hashCode#2005

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
jdeniau merged 1 commit into5.xfromhash-code-size-issue-with-ordered
Jul 22, 2024

Conversation

@jdeniau
Copy link
Member

@jdeniaujdeniau commentedJul 22, 2024
edited
Loading

when generating thehashCode of an element, we do use the size returned by__iterate. But in case ofOrdered element, the internal representation of the underlying list might contain undefined elements :

Example:

constm=OrderedMap({a:'a',b:'b'}).remove('a')

m.size is 1, the__iterate function will iterate only one time on theb key, but the internal_list element, will have two elements:[undefined, ['b', 'b']]:

image
Seehttps://runkit.com/jdeniau/immutable-hashcode-using-internal-list-size

I think that we should not use the value returned by__iterate, and use the object size directly.

Fixes#2002

@jdeniaujdeniauforce-pushed thehash-code-size-issue-with-ordered branch frombefe268 to0dc830cCompareJuly 22, 2024 09:27
@jdeniaujdeniau merged commitce2b028 into5.xJul 22, 2024
@jdeniaujdeniau deleted the hash-code-size-issue-with-ordered branchJuly 22, 2024 13:08
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@jdeniau

[8]ページ先頭

©2009-2025 Movatter.jp