summaryrefslogblamecommitdiff
path: root/test/files/neg/macro-blackbox-extractor/Macros_1.scala
blob: f0bfe53aa209cc030bf23c723e4308ed7e43a344 (plain) (tree)
1
2
3
4
5



                                           
                                                     















                                                    
import scala.reflect.macros.BlackboxContext
import language.experimental.macros

object Extractor {
  def unapply(x: Int): Any = macro Macros.unapplyImpl
}

object Macros {
  def unapplyImpl(c: BlackboxContext)(x: c.Tree) = {
    import c.universe._
    q"""
      new {
        class Match(x: Int) {
          def isEmpty = false
          def get = x
        }
        def unapply(x: Int) = new Match(x)
      }.unapply($x)
    """
  }
}