Skip to content
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

Groovy parser does not support multiple variable declarations #4748

Closed
jevanlingen opened this issue Dec 5, 2024 · 2 comments · Fixed by #4757
Closed

Groovy parser does not support multiple variable declarations #4748

jevanlingen opened this issue Dec 5, 2024 · 2 comments · Fixed by #4757
Assignees
Labels
bug Something isn't working parser-groovy

Comments

@jevanlingen
Copy link
Contributor

jevanlingen commented Dec 5, 2024

What is the smallest, simplest way to reproduce the problem?

@Test
void multipleAssignmentsAtOneLine() {
    rewriteRun(
        groovy(
            """
             def a = '1', b = '2'
            """
        )
     );
 }

What did you expect to see?

Working tests

What did you see instead?

Expected :"def a = '1', b = '2'"
Actual   :"def a = '1', bb = '2'"

Multiple variable declarations is also called combined variable declaration. Each variable is independently assigned, and there's no unpacking of a collection like it is with the multiple assignments groovy feature.

@knutwannheden
Copy link
Contributor

The B case seems like it is just a bug, that would probably be easy to fix. For the A case a new LST model element will be required.

@jevanlingen
Copy link
Contributor Author

jevanlingen commented Dec 5, 2024

I guess you are right, it's maybe better to split theses cases in two different issues. I moved case A to a new issue:

@jevanlingen jevanlingen changed the title Groovy parser does not support multiple assignments Groovy parser does not support multiple variable declarations Dec 9, 2024
@Laurens-W Laurens-W self-assigned this Dec 9, 2024
@Laurens-W Laurens-W linked a pull request Dec 10, 2024 that will close this issue
3 tasks
@timtebeek timtebeek moved this to In Progress in OpenRewrite Dec 13, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working parser-groovy
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants