Format: the composite repair rewrites section headers #291
Labels
No labels
bug
discussion
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
research
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gram-lang/gram#291
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found by the fuzz (
format-idempotent … second pass reported changes on an unchanged output, seed 1627016615, index 10547 ondev/1.6), present onmainanddev/1.6.Rule 6 of the formatter (glue a spaced composite,
@a{1} < @b{2}→@a{1}<@b{2}) runs on every line, section headers included. A##header holds no element: its title is plain text the compiler keeps as written. Two consequences:## <@s: rule 6 takes the blank after##, rule 8 puts it back. The text never changes, but every pass reports 2 changes (compositeSeparatorSpacing,headerSpacing), sogram format --checkwould fail forever on that file.## Zest <@lemon ~{-1 h}becomes## Zest<@lemon ~{-1 h}, and## Mix @a{1} < @b{2}becomes## Mix @a{1}<@b{2}: the compiled section title changes.Fix: rule 6 skips header lines (
##not followed by#, as rule 8 reads them).