importscala.reflect.macros.blackbox.Contextimportlanguage.experimental.macrosobjectExtractor{defunapply(x:Int):Any=macroMacros.unapplyImpl}objectMacros{defunapplyImpl(c:Context)(x:c.Tree)={importc.universe._q""" new { class Match(x: Int) { def isEmpty = false def get = x } def unapply(x: Int) = new Match(x) }.unapply($x) """}}