Fix duplicate table header when adding a key to an out-of-order table#545
Open
sarathfrancis90 wants to merge 1 commit into
Open
Conversation
…r table Adding a plain key to an out-of-order table whose concrete `[x]` part is declared after its sub-tables (the "defining a super-table afterward is ok" spec form) wrote the value into the header-less super part, forcing it to render a second `[x]` header next to the existing concrete one. The dumped output then had a duplicate header and no longer parsed. Route the value into the existing concrete (non-super) part instead, so the header that already exists gains the key and no second header is emitted.
4ff9bc2 to
1cf87f8
Compare
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.
While editing a parsed document I hit invalid output from a plain assignment. If a table is split out of order so its concrete
[x]header comes after its sub-tables (the "defining a super-table afterward is ok" spec form), adding a key to it writes a second[x]header and the result no longer parses:The out-of-order proxy was putting the new value in the header-less super part (the one created by
[x.y.z.w]), which then had to emit its own[x]header next to the existing empty concrete[x]. I changed the plain-value fallback to route into the existing concrete (non-super) part instead, so the header that's already there gains the key and no duplicate header is written.Added a regression test. The full
pytestsuite is green and the change isruff/ruff formatclean.