Skip to content

Conversation

@som-snytt
Copy link
Contributor

@som-snytt som-snytt commented Dec 7, 2025

Warns on definitions named with embedded dollars, which should must be written in backquotes, if at all.

Fixes #18234

Test from #18563

@sjrd
Copy link
Member

sjrd commented Dec 7, 2025

which should be written in backquotes

They should not be written at all, in fact. ;)

@som-snytt som-snytt force-pushed the issue/18234-dollar-idents branch from 965c5f3 to 3690e96 Compare December 7, 2025 13:32
@som-snytt
Copy link
Contributor Author

som-snytt commented Dec 7, 2025

This proposal aims to accommodate the two views, which are not entirely incompatible, that strict enforcement is required and yet Java doesn't need it so why does Scala?, where the question is posed with a large dosage of skepticism about warnings.

Here, there is no forking compiler option. Definitions with suspect names are disallowed, with a migration warning now and an error later. However, the workaround, to permit the identifier in backquotes, is quite natural and pleasant, as we have all come to savor backquotes in new syntactic contexts. Backquotes are not required for references (usages).

CB c includes the original izumi-reflect example.

A rewrite will be offered in a follow-up. The corner case is pattern variables, where it's not sufficient to simply wrap the identifier in backquotes.

@som-snytt som-snytt force-pushed the issue/18234-dollar-idents branch from 3690e96 to 3fe96a5 Compare December 7, 2025 20:29
@som-snytt som-snytt force-pushed the issue/18234-dollar-idents branch from 3fe96a5 to 9754e00 Compare December 7, 2025 20:30
@som-snytt som-snytt marked this pull request as ready for review December 8, 2025 18:13
@som-snytt som-snytt requested a review from a team as a code owner December 8, 2025 18:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enforce spec on identifiers containing $s

2 participants