Skip to content

Commit 93eaaaf

Browse files
committed
Add test case
1 parent a853fe9 commit 93eaaaf

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/pos/quoted.scala

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import scala.quoted._
2+
3+
class Test {
4+
5+
object Macros {
6+
7+
inline def assert(expr: => Boolean): Unit =
8+
~ assertImpl('(expr))
9+
10+
def assertImpl(expr: Expr[Boolean]) =
11+
'{ if !(~expr) then throw new AssertionError(s"failed assertion: ${~expr}") }
12+
13+
}
14+
15+
val program = '{
16+
import Macros._
17+
18+
val x = 1
19+
assert(x != 0)
20+
21+
~assertImpl('(x != 0))
22+
}
23+
24+
program.run
25+
}

0 commit comments

Comments
 (0)