Conversation
Add key-path tracking and 4-step validation to `toml:read-inline-table`:
Three tracking lists are maintained across the while loop:
- defined-paths: leaf paths that have been assigned a value
- implicit-paths: intermediate paths created by dotted keys
- inline-table-paths: paths whose value is an inline table (alist)
Validation steps (executed in order before storing each key-value):
1. Exact duplicate: full-path already in defined-paths
e.g. {b=1, b=2}
2. Implicit table overwrite: full-path is a proper prefix of
an existing defined-path (would destroy children)
e.g. {b.c=1, b=2}
3. Inline table immutability: a proper prefix of full-path is
in inline-table-paths (TOML spec forbids extending inline tables)
e.g. {inner={dog="best"}, inner.cat="worst"}
4. Nesting into scalar: a proper prefix of full-path is in
defined-paths but not in implicit-paths or inline-table-paths
e.g. {b=1, b.c=2}
Steps 1/2 check defined-paths (any value type), while step 3
specifically checks inline-table-paths (alist values only).
Step 4 catches the reverse direction of step 2 (child under scalar).
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
close #90