Closed
Description
// Macro_1.scala
package macros
import scala.quoted._
var saved = Option.empty[Expr[Any]]
def oops(c: Expr[Any])(using QuoteContext) = {
if saved.isEmpty then
saved = Some(c)
c
else saved.get
}
inline def test(c: Any) = ${oops('c)}
// Test_2.scala
object Test {
class A(x: Int) {
macros.test(x)
}
class B(y: String) {
macros.test(y)
}
}
Originally posted by @LPTK in #7142 (comment)