Skip to content

Widening the type of ForEachLoop.Control.variable to Statement #5608

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

greg-at-moderne
Copy link
Contributor

@greg-at-moderne greg-at-moderne commented Jun 11, 2025

What's changed?

In Java:

  • changing the type of ForEachLoop.Control.variable from VariableDeclarations to Statement.

In Javascript:

  • using this to handle cases where for-of or for-in loops use a variable declared before the loop.

What's your motivation?

As designed with @jkschneider and @knutwannheden this is to accommodate a broader set of JS/TS for loops.

Anything in particular you'd like reviewers to focus on?

Note - this slightly changes the API for J.ForEachLoop. As checked before, this will cause some minor compilation issues in a few (roughly around 5) places downstream in openrewrite org.

@greg-at-moderne greg-at-moderne marked this pull request as ready for review June 11, 2025 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants