We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f2f9991 + c313fd7 commit c48a598Copy full SHA for c48a598
tests/run-staging/i8178.scala
@@ -0,0 +1,15 @@
1
+import scala.quoted._
2
+import scala.quoted.staging._
3
+
4
+def foo(n: Int, t: Expr[Int])(using QuoteContext): Expr[Int] =
5
+ if (n == 0) t
6
+ else '{ val a = ${Expr(n)}; ${foo(n - 1, 'a)} + $t }
7
8
+@main def Test = {
9
+ // make available the necessary toolbox for runtime code generation
10
+ given Toolbox = Toolbox.make(getClass.getClassLoader)
11
12
+ val f: Int = run { foo(2, Expr(5)) }
13
14
+ println(f)
15
+}
0 commit comments