Skip to content

fix(fmt): balance override variable indentation#15153

Merged
figtracer merged 1 commit into
masterfrom
codex/fix-fmt-override-var-indent
Jun 12, 2026
Merged

fix(fmt): balance override variable indentation#15153
figtracer merged 1 commit into
masterfrom
codex/fix-fmt-override-var-indent

Conversation

@figtracer

@figtracer figtracer commented Jun 12, 2026

Copy link
Copy Markdown
Member

Fixes #15151.

Summary

  • Balance the extra formatter box opened for state variables with an override attribute when the variable has no initializer.
  • Add regression coverage for uninitialized override variables followed by top-level declarations, a following contract member, override path lists, and the initializer case that already worked.

Root Cause

print_var opens an additional box while printing override attributes. The initializer path closes that box before formatting the RHS, but the no-initializer path only closed the regular variable boxes. That left the pretty-printer one indent level deep, so later source-unit items were emitted indented.

@figtracer figtracer changed the title [codex] fix(fmt): balance override variable indentation fix(fmt): balance override variable indentation Jun 12, 2026
Co-authored-by: clouds56 <730813+clouds56@users.noreply.github.com>
@figtracer figtracer force-pushed the codex/fix-fmt-override-var-indent branch from 96717c4 to 9240816 Compare June 12, 2026 07:54
@figtracer figtracer marked this pull request as ready for review June 12, 2026 07:54
@figtracer figtracer enabled auto-merge (squash) June 12, 2026 07:57

@grandizzy grandizzy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@figtracer figtracer merged commit d9bf0c6 into master Jun 12, 2026
19 checks passed
@figtracer figtracer deleted the codex/fix-fmt-override-var-indent branch June 12, 2026 08:06
@github-project-automation github-project-automation Bot moved this to Done in Foundry Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

bug(fmt): forge fmt incorrectly indents top-level declarations after override state variable without initializer

3 participants