Skip to content

Go: fix parsing of condition-only for loops using semicolons#7560

Merged
greg-at-moderne merged 1 commit intomainfrom
greg-go-for-rune-semi
May 4, 2026
Merged

Go: fix parsing of condition-only for loops using semicolons#7560
greg-at-moderne merged 1 commit intomainfrom
greg-go-for-rune-semi

Conversation

@greg-at-moderne
Copy link
Copy Markdown
Contributor

@greg-at-moderne greg-at-moderne commented May 4, 2026

What's changed?

Fixing the case of for loops which don't use the 3-arg (int i=0; i<5; i++), but rather the 1-arg version. If they happen to contain ; even in a literal, they shouldn't be treated as the 3-arg, e.g.

for tok != ';' { ... }

What's your motivation?

The parsing fails with idempotency issues.

@greg-at-moderne
Copy link
Copy Markdown
Contributor Author

The CI failures are unrelated (they pertain to Gradle).

@greg-at-moderne greg-at-moderne marked this pull request as ready for review May 4, 2026 08:37
@greg-at-moderne greg-at-moderne merged commit 13ab62a into main May 4, 2026
1 check failed
@greg-at-moderne greg-at-moderne deleted the greg-go-for-rune-semi branch May 4, 2026 08:37
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant