aboutsummaryrefslogtreecommitdiff
path: root/tests/run/virtpatmat_stringinterp.scala
blob: 6ce1bf9c50939da6f0833fd06ebd8c2b4c062d8e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import scala.language.{ implicitConversions }

object Test extends dotty.runtime.LegacyApp {
  case class Node(x: Int)

  implicit def sc2xml(sc: StringContext): XMLContext = new XMLContext(sc)
  class XMLContext(sc: StringContext) {
    object xml {
      def unapplySeq(xml: Node): Option[Seq[Node]] = Some(List(Node(1)))
    }
  }

  val x: Node = Node(0)
  x match { case xml"""<foo arg=$a/>""" => println(a) }
}