Skip to content

Commit c48a598

Browse files
Merge pull request #8184 from dotty-staging/fix-8178
Fix #8178: add test
2 parents f2f9991 + c313fd7 commit c48a598

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/run-staging/i8178.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)