Skip to content

fix: add missing space before do in for loop pretty-printing - #14512

Merged
sgraf812 merged 1 commit into
masterfrom
sg/fix-for-do-pp
Jul 23, 2026
Merged

fix: add missing space before do in for loop pretty-printing#14512
sgraf812 merged 1 commit into
masterfrom
sg/fix-for-do-pp

Conversation

@sgraf812

Copy link
Copy Markdown
Contributor

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.

@sgraf812 sgraf812 added the changelog-pp Pretty printing label Jul 23, 2026
@github-actions github-actions Bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jul 23, 2026
@mathlib-lean-pr-testing

Copy link
Copy Markdown

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase 46e7a11028e13dc0cf67368535d6762aa1699475 --onto 3259610687883ec1ea48c481aba2469f2f83facf. You can force Mathlib CI using the force-mathlib-ci label. (2026-07-23 09:47:45)

@leanprover-bot

Copy link
Copy Markdown
Collaborator

Reference manual CI status:

  • ❗ Reference manual CI will not be attempted unless your PR branches off the nightly-with-manual branch. Try git rebase 46e7a11028e13dc0cf67368535d6762aa1699475 --onto 49ff95727f98d43984726b26742d17a1ceea9dd5. You can force reference manual CI using the force-manual-ci label. (2026-07-23 09:47:47)

@sgraf812
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
sgraf812 enabled auto-merge July 23, 2026 11:44
@sgraf812
sgraf812 added this pull request to the merge queue Jul 23, 2026
Merged via the queue into master with commit 2b3c28a Jul 23, 2026
17 checks passed
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-pp Pretty printing toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants