fix: add missing space before do in for loop pretty-printing - #14512
Merged
Conversation
|
Mathlib CI status (docs):
|
Collaborator
|
Reference manual CI status:
|
sgraf812
force-pushed
the
sg/fix-for-do-pp
branch
from
July 23, 2026 10:31
f767ff2 to
5008fd7
Compare
sgraf812
marked this pull request as ready for review
July 23, 2026 11:36
This PR makes a `for` do-element pretty-print with a space before `do`, matching `while`, `unless`, and the term-level `for`, which all already emit ` do `.
sgraf812
force-pushed
the
sg/fix-for-do-pp
branch
from
July 23, 2026 11:38
5008fd7 to
046d506
Compare
sgraf812
enabled auto-merge
July 23, 2026 11:44
robsimmons
pushed a commit
that referenced
this pull request
Jul 29, 2026
) This PR makes a `for` do-element pretty-print with a space before `do`. The do-element `for` parser emitted `"do "` with no leading space, so reformatting a `for … do` block glued the range to the keyword (`for x in xs do` printed as `for x in xsdo`). Every sibling do-keyword (`while`, `unless`, term-level `for`) already emits ` do `; this aligns `for`. A small formatter test parses a `for … do` block and pins the spaced output.
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.
This PR makes a
fordo-element pretty-print with a space beforedo. The do-elementforparser emitted"do "with no leading space, so reformatting afor … doblock glued the range to the keyword (for x in xs doprinted asfor x in xsdo). Every sibling do-keyword (while,unless, term-levelfor) already emitsdo; this alignsfor.A small formatter test parses a
for … doblock and pins the spaced output.