summaryrefslogblamecommitdiff
path: root/test/files/neg/macro-blackbox-extractor/Macros_1.scala
blob: 5c7748bec95d03de9395fc3bf77e209f82a025d5 (plain) (tree)




















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

object Extractor {
  def unapply(x: Int) = 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)
    """
  }
}