Search code examples
scalametaprogrammingscala-macrosscala-3

Is quasiquote removed from scala 3?


I'm reading metaprogramming manual on Scala 3 and didn't find quasiqotes that I heavily use in my current project. What is the alternative for deconstructuring trees like that:

def impl(c: blackbox.Context): c.Expr[Unit] = {
    import c.universe._
    
    val someTree = //...
    someTree match {
        case typedef @ q"$mods type $name[..$tparams] >: $low <: $high" =>
            //...
        
    }
}

How to port such code with tree deconstructioning to Scala 3?


Solution

  • You can pattern match on Exprs in Scala 3:

    https://dotty.epfl.ch/docs/reference/metaprogramming/macros.html#pattern-matching-on-quoted-expressions