Skip to content

Commit 38cf5c3

Browse files
committed
WIP Add test cases
1 parent 7f2771e commit 38cf5c3

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

tests/run-macros/i17105/Macro_1.scala

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import scala.quoted.*
2+
3+
inline def test1: String = ${ testExpr1 }
4+
def testExpr1(using Quotes): Expr[String] =
5+
'{ def f(x: Int) = 1; val n = 2; f(n) } match
6+
case '{ def g(y: Int) = 1; val n = 2; $a(g, n): Int } => Expr(a.show)
7+
case _ => Expr("not matched")
8+
9+
inline def test2: String = ${ testExpr2 }
10+
def testExpr2(using Quotes): Expr[String] =
11+
'{ def f(x: Int, y:Int) = 1; f(1, 2) } match
12+
case '{ def g(y: Int, z:Int) = 1; $a(g): Int } => Expr(a.show)
13+
case _ => Expr("not matched")
14+
15+
inline def test3: String = ${ testExpr3 }
16+
def testExpr3(using Quotes): Expr[String] =
17+
'{
18+
def f1(using Ordered[Int]) =
19+
def f2(using Ordered[Int]) =
20+
1 < 2
21+
f2 || 2 < 3: Boolean
22+
} match
23+
case '{
24+
def g1(using ord: Ordered[Int]) =
25+
def g2(using Ordered[Int]) =
26+
1 < 2
27+
$a(g2, ord): Boolean
28+
} => Expr(a.show)
29+
case _ => Expr("not matched")
30+

tests/run-macros/i17105/Test_2.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@main def app =
2+
println(test1)
3+
println(test2)
4+
println(test3)

0 commit comments

Comments
 (0)