fix(format): keep the trailing zeros of a fraction's terms #287
No reviewers
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!287
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/format-decimal-denominator"
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?
Fixes #286.
Rule 4 (trailing decimal zeros) also trimmed a term of a fraction. The compiler reads neither
1.0/5nor1/5.0as a duration (INVALID_DURATION, or a text quantity), while it reads1/5, sogram formatchanged a timer (fuzzformat-preserves-meaning … at $.metrics.activeBreakdown[]):~{1.0/5 min}went from the default 2 min to 0.2 min,~{1/5.0 min / 500.0 g @&b}to 0.04 min.DECIMAL_WITH_ZEROSno longer matches a number glued to a/(blanks allowed). A ratio's/is never inside one number's range, so ratio terms are still trimmed ({1.50 / 100.0 g @&b}→{1.5 / 100 g @&b},~{15.0 min / 500.0 g @&b}→~{15 min / 500 g @&b}). Cosmetic cost:{1.50/2 g}stays as written.packages/format/tests/formatter.test.ts(3 fail without the fix;~{1/5.0 min}, read as text, is a guard), plusfuzz/regressions/286-fraction-zeros-timer.gram(fails on the old formatter).patchchangeset for@gram-lang/format.Checks: 3934 pass / 1 skip / 0 fail, conformance 142/142 and 24/24 with no golden change, typecheck, biome,
deprecations:check, audit 126, fuzz 50k (seed 3618048934, 0 signature).Independent of #285 (no overlapping lines). Related, out of scope (noted in #286): the parser reads
{1.5/2}as 0.75 while kitchen's timer duration rejects~{1.5/2 min}.