Skip to content

Scala: support for right-associative operators in infix syntax#7410

Merged
greg-at-moderne merged 1 commit intomainfrom
greg-scala-infix-operators
Apr 17, 2026
Merged

Scala: support for right-associative operators in infix syntax#7410
greg-at-moderne merged 1 commit intomainfrom
greg-scala-infix-operators

Conversation

@greg-at-moderne
Copy link
Copy Markdown
Contributor

@greg-at-moderne greg-at-moderne commented Apr 17, 2026

What's your motivation?

In Scala operators ending in : used in infix syntax are right-associative. For instance:

val xs = 1 :: Nil

means the same as

val xs = Nil.::(1)

Without the fix, it would parse the tree wrong.

What's changed?

Adding RightAssociative marker to Scala to make sure the parsed LST keeps the semantics. And thanks to the marker, the printer deals with the syntax.

@github-project-automation github-project-automation bot moved this to In Progress in OpenRewrite Apr 17, 2026
@greg-at-moderne greg-at-moderne marked this pull request as ready for review April 17, 2026 11:06
@greg-at-moderne greg-at-moderne merged commit 08c7fb1 into main Apr 17, 2026
1 check passed
@greg-at-moderne greg-at-moderne deleted the greg-scala-infix-operators branch April 17, 2026 11:06
@github-project-automation github-project-automation bot moved this from In Progress to Done in OpenRewrite Apr 17, 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