Closed
Description
Compiler version
3.3.1, 3.4.0-RC1-bin-20240103-94e960d-NIGHTLY
Minimized code
Main.scala
@main def main() =
val Unapplier(result) = Some(5)
Macro.scala
import scala.quoted._
object Unapplier:
transparent inline def unapply(arg: Any): Option[Int] = ${unapplyImpl('arg)}
def unapplyImpl(using Quotes)(argExpr: Expr[Any]): Expr[Option[Int]] =
println("a method so nice I'll run it twice")
'{Some(1)}
Output
compilation output:
a method so nice I'll run it twice
a method so nice I'll run it twice
Expectation
The method should be executed only one time per call, like when using non-transparent inline unapply, or when using transparent inline macros on non-unapply methods.