Skip to content

Parsing error with $_ and $_id in interpolated strings #1779

Closed
@liufengyun

Description

@liufengyun

Dotty cannot parse $_ and $_id, while Scalac only supports $_.

object Test {
  implicit class Foo(sc: StringContext) {
    object q {
      def unapply(arg: Any): Option[(Any, Any)] =
        Some((sc.parts(0), sc.parts(1)))
    }
  }

  def main(args: Array[String]): Unit = {
    val q"class $_ extends $_parent" = new Object
    println(_parent)
  }
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions