Skip to content

Backquote quirk in pattern #24162

@som-snytt

Description

@som-snytt

Compiler version

3.7.3

Minimized code

scala> i match { case `-`42 => "yay" }
[[syntax trees at end of                     typer]] // rs$line$3
package <empty> {
  final lazy module val rs$line$3: rs$line$3 = new rs$line$3()
  final module class rs$line$3() extends Object() { this: rs$line$3.type =>
    val res1: String =
      i match
        {
          case -42 =>
            "yay"
        }
  }
}

val res1: String = yay

Expectation

The backquoted hyphen is not minus.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions