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 merging MapLikeSerializers when merging with non-empty maps #1712

Merged
merged 1 commit into from Oct 14, 2021

Conversation

pdvrieze
Copy link
Contributor

@pdvrieze pdvrieze commented Oct 1, 2021

As maps are serialized as arrays of interleaved keys and values the effective builder size
should take this into account and multiply by 2. This keeps readElement calls consistent between both complete and multiple partial (merged) reads.

… the actual size * 2).

The index in the conceptual array is twice the amount of elements in the list. This way the
reading is consistent between single and multipass. Also decoders can thus use even/odd to
determine whether to read the key or value.
Copy link
Member

@sandwwraith sandwwraith left a comment

Choose a reason for hiding this comment

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

Indeed, you're right. Thanks!

@sandwwraith sandwwraith merged commit 85be8a7 into Kotlin:dev Oct 14, 2021
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.

None yet

2 participants