Skip to content

Scala: add support for parsing primary-constructor parameters#7643

Merged
greg-at-moderne merged 3 commits into
mainfrom
greg-scala-ctor-params-rich-types
May 11, 2026
Merged

Scala: add support for parsing primary-constructor parameters#7643
greg-at-moderne merged 3 commits into
mainfrom
greg-scala-ctor-params-rich-types

Conversation

@greg-at-moderne
Copy link
Copy Markdown
Contributor

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

What's changed?

Fix Scala parser to support primary-constructor parameters, e.g. class Greeter(name: String = "world")

What's your motivation?

It's not supported right now, some idempotency failures are observed.

Fixes regression caught by IdentifierTest.backtickIdentifierAcrossContexts
(added on main in 73358e5 after this branch forked): `case class
CC(`type`: String)` lost its closing backtick because vd.name.toString
strips backticks and vd.nameSpan covers only the raw identifier.
@greg-at-moderne greg-at-moderne force-pushed the greg-scala-ctor-params-rich-types branch from 75b931d to ad3b8e5 Compare May 11, 2026 11:11
@greg-at-moderne greg-at-moderne marked this pull request as ready for review May 11, 2026 11:40
@greg-at-moderne greg-at-moderne merged commit 03f0e87 into main May 11, 2026
1 check passed
@greg-at-moderne greg-at-moderne deleted the greg-scala-ctor-params-rich-types branch May 11, 2026 11:40
@github-project-automation github-project-automation Bot moved this from In Progress to Done in OpenRewrite May 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant