Closed
Description
Let's consider the following macro based string interpolator
import scala.quoted._
import scala.tasty.Tasty
object Macro {
class StringContextOps(sc: StringContext) {
rewrite def ff(args: => Any*): String = ~Macro.impl('(sc), '(args))
}
implicit rewrite def XmlQuote(sc: => StringContext): StringContextOps = new StringContextOps(sc)
def impl(sc: Expr[StringContext], args: Expr[Seq[Any]])(implicit tasty: Tasty): Expr[String] = '("")
}
And the following use case:
class Test {
import Macro._
def test = ff"Hello World"
}
which expands to:
class Test {
def test: String = {
// start dead code
val $1$: Macro.Macro$StringContextOps =
new Macro.Macro$StringContextOps(
_root_.scala.StringContext.apply(
Predef.wrapRefArray(["Hello World" : String])
)
)
// end dead code
// expansion
""
}
}
My expectation (and how it works in Scala 2) is that the receiver of the macro gets elided