Skip to content

Scala: handle case guards with complex (block) conditions#7913

Merged
greg-at-moderne merged 1 commit into
mainfrom
greg-scala-match-block-guard
Jun 5, 2026
Merged

Scala: handle case guards with complex (block) conditions#7913
greg-at-moderne merged 1 commit into
mainfrom
greg-scala-match-block-guard

Conversation

@greg-at-moderne
Copy link
Copy Markdown
Contributor

@greg-at-moderne greg-at-moderne commented Jun 5, 2026

What's changed?

It turns out Scala can have a whole block of code in the case guard, e.g.

                case s: String if {
                      s.nonEmpty
                    } => s

Thus providing support for such syntax.

What's your motivation?

Otherwise it fails to parse properly with the guard being swallowed.

@github-project-automation github-project-automation Bot moved this to In Progress in OpenRewrite Jun 5, 2026
@greg-at-moderne greg-at-moderne marked this pull request as ready for review June 5, 2026 13:48
@greg-at-moderne greg-at-moderne merged commit 37d6726 into main Jun 5, 2026
1 check passed
@greg-at-moderne greg-at-moderne deleted the greg-scala-match-block-guard branch June 5, 2026 13:48
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite Jun 5, 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