summaryrefslogblamecommitdiff
path: root/test/files/neg/macro-blackbox-extractor/Macros_1.scala
blob: 64b6270b74af03c41b1f6a61ae89d93b7f719e34 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                            


                                   
                                                     


               
                                            











                                          
import scala.reflect.macros.blackbox.Context
import language.experimental.macros

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

object Macros {
  def unapplyImpl(c: Context)(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)
    """
  }
}