Skip to content

Commit 7e4ac15

Browse files
committed
Add splice-position test
1 parent 3f978b3 commit 7e4ac15

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

tests/run/splice-position.check

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Test$.main(Test.scala:3)
2+
Test$.main(Test.scala:4)

tests/run/splice-position/Test.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
object Test:
2+
def main(args: Array[String]) =
3+
try assertTrue(1 == 2) catch e => println(e.getStackTrace()(0))
4+
try assertTrue(1 == 3) catch e => println(e.getStackTrace()(0))
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import scala.quoted.{Quotes, Expr, quotes}
2+
3+
inline def assertTrue(cond: Boolean) =
4+
${ assertTrueImpl('cond) }
5+
6+
def assertTrueImpl(cond: Expr[Boolean])(using Quotes) =
7+
'{ if (!$cond) throw new Error(${'{""}}) }

0 commit comments

Comments
 (0)