-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:metaprogramming:quotesIssues related to quotes and splicesIssues related to quotes and splicesitype:enhancement
Milestone
Description
Compiler version
3.2.0
Minimized code
//file a.scala
object betaReduceTest {
inline def macroPolyFun[A](inline arg: A, inline f: [Z] => Z => String): String =
${ macroPolyFunImpl[A]('arg, 'f) }
def macroPolyFunImpl[A: Type](arg: Expr[A], f: Expr[[Z] => Z => String])(using Quotes): Expr[String] =
Expr.betaReduce('{ $f($arg) })
inline def macroFun[A](inline arg: A, inline f: A => String): String =
${ macroFunImpl[A]('arg, 'f) }
def macroFunImpl[A: Type](arg: Expr[A], f: Expr[A => String])(using Quotes): Expr[String] =
Expr.betaReduce('{ $f($arg) })
}
//file b.scala
object betaReduceTest2 {
def test: Unit = {
betaReduceTest.macroPolyFun("foo", [Z] => (arg: Z) => arg.toString)
betaReduceTest.macroFun("foo", arg => arg.toString)
}
}
Decompiled code (with Fernflower)
public void test() {
String var10000 = (String)((Function1)(new 1())).apply("foo");
"foo".toString();
}
Expectation
That both the normal and poly function both beta reduce
Metadata
Metadata
Assignees
Labels
area:metaprogramming:quotesIssues related to quotes and splicesIssues related to quotes and splicesitype:enhancement