I would expect the following to work:
import scala.quoted.*
object MyMatcher {
def unapply(expr: Expr[Any])(using Quotes): Option[Expr[Int]] = ???
}
def foo(x: Any): Unit = ???
def f(expr: Expr[Any])(using Quotes): Expr[Int] = expr match
case '{ foo(${y@MyMatcher(_)}) } => y
But if fails to compile with
; expected but @ found
Is there a way to bind the result of an inner matcher?