docs(lath): correct replaceAtPath off-tree-path comment - #363
Open
dormouse-bot wants to merge 1 commit into
Open
docs(lath): correct replaceAtPath off-tree-path comment#363dormouse-bot wants to merge 1 commit into
dormouse-bot wants to merge 1 commit into
Conversation
The doc claimed an off-tree path 'returns replacement unchanged from wherever the walk stopped', but the code returns the original subtree reached so far and never inserts replacement (return root on a leaf hit or missing child index). Reword to match actual behavior.
Deploying mouseterm with
|
| Latest commit: |
ee2fb00
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://6c86c347.mouseterm.pages.dev |
| Branch Preview URL: | https://docs-lath-replaceatpath-comm.mouseterm.pages.dev |
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.
Problem
The
replaceAtPathdoc comment inlib/src/lib/lath/model.tsdescribes the off-tree-path behavior as returningreplacement:The code does the opposite. When the walk leaves the tree — hitting a leaf before
pathis exhausted (if (root.kind !== 'split') return root;) or naming a missing child (if (!child) return root;) — it returns the original subtree reached so far and never insertsreplacement. A reader relying on the comment could assumereplacementgets grafted on an off-tree path when in fact it is dropped.Solution
Reword the comment to match the actual behavior: an off-tree path returns the subtree reached so far unchanged, without inserting
replacement.Testing
Documentation-only change; no test added. The behavior itself is unchanged.
Surfaced by the nightly code-quality survey.