close
Skip to content

fix(grainfmt): Correct formatting of record assignments#2344

Merged
spotandjake merged 1 commit into
grain-lang:mainfrom
spotandjake:spotandjake/fix-record-assign-fmt
Jan 16, 2026
Merged

fix(grainfmt): Correct formatting of record assignments#2344
spotandjake merged 1 commit into
grain-lang:mainfrom
spotandjake:spotandjake/fix-record-assign-fmt

Conversation

@spotandjake
Copy link
Copy Markdown
Member

I noticed that at.y.x += 10 was being formatted as at.y.x = at.y.x + 10 this was because we only checked one level deep on record assignments. While fixing this I also noticed that we compared the identifier directly on patterns such as at.y += 10 which means that at.y += 10 gets formatted as at.y += 10 however at.y = at.y + 10 doesn't get collapsed due to the locations on the identifier differing.

Closes: #2343

@spotandjake spotandjake self-assigned this Jan 16, 2026
@spotandjake spotandjake added the grainfmt Issues related to the Grain formatter label Jan 16, 2026
@ospencer ospencer added this pull request to the merge queue Jan 16, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jan 16, 2026
I noticed that `at.y.x += 10` was being formatted as `at.y.x = at.y.x + 10` this was because we only checked one level deep on record assignments. While fixing this I also noticed that we compared the identifier directly on patterns such as `at.y += 10` which means that `at.y += 10` gets formatted as `at.y += 10` however `at.y = at.y + 10` doesn't get collapsed due to the locations on the identifier differing.

Closes: grain-lang#2343
@spotandjake spotandjake force-pushed the spotandjake/fix-record-assign-fmt branch from c9d889b to 66089be Compare January 16, 2026 17:44
@spotandjake spotandjake added this pull request to the merge queue Jan 16, 2026
Merged via the queue into grain-lang:main with commit 7786d60 Jan 16, 2026
12 checks passed
@spotandjake spotandjake deleted the spotandjake/fix-record-assign-fmt branch January 16, 2026 18:47
@github-actions github-actions Bot mentioned this pull request Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

grainfmt Issues related to the Grain formatter

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Formatter: Infix nested record assignments get unformatted

2 participants