Closed
Description
Minimized example
import scala.quoted._
object OtherMacro {
def impl(using qctx: QuoteContext): Expr[Int] =
'{ 42 }
inline def apply = ${ OtherMacro.impl }
}
object Macro {
def impl(using qctx: QuoteContext): Expr[Int] = {
import qctx.tasty._
import util._
// Simply returning this term is OK
// Select.unique(
// '{ OtherMacro }.unseal,
// "apply"
// ).seal.cast[Int]
let(
Select.unique(
'{ OtherMacro }.unseal,
"apply"
)
)(identity).seal.cast[Int]
}
inline def apply = ${ Macro.impl }
}
Output
[error] 3 | val a = Macro.apply
[error] | ^^^^^^^^^^^
[error] | method apply is declared as erased, but is in fact used
Expectation
Either TASTY reflect terms shouldn't be expanded, or possibly we can expand them explicitly? If you simply return the commented out code, the macro gets expanded.
If you have a quote with a macro it gets expanded as expected.