I have a inline object to a quote that implements a deferred inline. If I reference this object directly in a quote: No problem. If I try to pass the object in then I get a “deferred inline method cannot be invoked” error. Which, makes sense if the object is referenced only via the trait but I thought this would be inlined. Much like the line above the error O0.d0(1)
trait T0 {
inline def d0(x: Int): String
}
object O0 extends T0 {
inline def d0(x: Int) = x.toString
}
object Macros {
import scala.quoted.*
def doItImpl[O <: T0](o: Expr[O])(using Quotes): Expr[String] = {
import quotes.reflect.*
'{
O0.d0(1)
$o.d0(1)
}
}
inline def doIt[O <: T0](inline o: O): String = ${ doItImpl('o) }
}
@main
def main(): Unit = {
println(Macros.doIt(O0))
}