summaryrefslogtreecommitdiff
path: root/test/files/run/virtpatmat_stringinterp.scala
blob: c6c951e6e5f08da85d70d5887bf5218870a81b77 (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 App {
  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) }
}