Skip to content

Enforce spec on identifiers containing $s #18234

@nicolasstucki

Description

@nicolasstucki

The Scala spect states:

The ‘$’ character is reserved for compiler-synthesized identifiers. User programs should not define identifiers which contain ‘$’ characters.

Using such identifiers can easily lead to issues (including unsoundness). The last known occurrence of this issue happened in #18227. We had several prior bugs reported, all ended up with a link to the spec but no action on the compiler.

Unfortunately, the compiler does not enforce or warn about uses of these identifiers. Users are unlikely to learn about this obscure line in the middle of the spec.

We should warn the users if the use an identifier with $s. We should not make it an error as there are some legitimate corner cases where $ in the source code is used (such as in the stdlib and for backward binary compact patches).

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:lintingLinting warnings enabled with -W or -Xlintarea:reportingError reporting including formatting, implicit suggestions, etcitype:enhancement

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions