Skip to content

Inconsistent parsing of symbols wrapped in backticks #15547

@nrinaudo

Description

@nrinaudo

Compiler version

3.1.2

Minimized code

def `=`: String = "="
def `+`: String = "+"

val withEq: String   = `=` + "3"
val withPlus: String = `+` + "3"

Output

Compile error on the last line:

; expected but string constant found

See https://scastie.scala-lang.org/WCnbXR7RRzOuc8zYkrlxUQ for a "live" reproduction

Expectation

Either a compile error for both withEq and withPlus, or none, but this seems inconsistent.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions