Fix join_into dropping the source when the destination node is empty - #70
Open
imlvts wants to merge 1 commit into
Open
Fix join_into dropping the source when the destination node is empty#70imlvts wants to merge 1 commit into
imlvts wants to merge 1 commit into
Conversation
Joining a non-empty source into an *empty* destination map reported `Identity` and wrote nothing; the same join into a destination holding one unrelated key worked. `try_as_tagged` answers `Some` for a `BorrowedRc` whatever it holds, so an empty destination node took the `pjoin_dyn` path and came back `Identity(SELF_IDENT)`: "the result is what you already have", which for an empty destination is nothing. The function already draws the distinction between "no node" and "an empty node" for the *source*, with an explicit `node_is_empty` check in the branch above; it did not draw it for the destination. Now it does, and an empty node takes the same path as a missing one, because the union of nothing with the source is the source. The model agrees: `join_into` with an empty `self` node joins to the source and reports `Element`. Regression test: `write_zipper_join_into_empty_destination`, into an empty map, into a dangling path, and into a non-empty map. Fails before this change with the data missing. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01BZmoASqM5FUuzvJeJaYQjR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Joining a non-empty source into an empty destination map reported
Identityand wrote nothing; the same join into a destination holding one unrelated key worked.try_as_taggedanswersSomefor aBorrowedRcwhatever it holds, so an empty destination node took thepjoin_dynpath and came backIdentity(SELF_IDENT): "the result is what you already have", which for an empty destination is nothing.The function already draws the distinction between "no node" and "an empty node" for the source, with an explicit
node_is_emptycheck in the branch above; it did not draw it for the destination. Now it does, and an empty node takes the same path as a missing one, because the union of nothing with the source is the source. The model agrees:join_intowith an emptyselfnode joins to the source and reportsElement.Regression test:
write_zipper_join_into_empty_destination, into an empty map, into a dangling path, and into a non-empty map. Fails before this change with the data missing.