Has the equivalent of scala.reflect.macros.Parsers been removed? #12500
-
| In Scala2's macro, I could dynamically construct expressions by using Context.parse and so on.   def generateExpr[T: c.WeakTypeTag](target: C#Symbol): C#Expr[T] = {
    if (target.isModule) {
      c.Expr[T](c.parse(target.fullName))
    } else {
      c.Expr[T] {
        c.parse(
          s"""new ${target.fullName}(${
            val a = target.asClass.primaryConstructor.asMethod
            val b = a.paramLists
            target.asClass.primaryConstructor.asMethod.paramLists
              .collect {
                case curry if !curry.exists(_.isImplicit) =>
                  curry.map { param => s"inject[${param.typeSignature.toString}]" }.mkString(",")
              }
              .mkString(")(")
          }) with MixIn"""
        )
      }
    }
  }I was able to expand the TypeSignature into a Quasiquotes. It is not easy to define an EXpression that takes  | 
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
| 
 | 
Beta Was this translation helpful? Give feedback.
https://contributors.scala-lang.org/t/compatibility-required-for-migration-from-scala2-macro/5100/2?u=giiita