Skip to content

Commit 74bef21

Browse files
committed
WIP: Add test case for curried method
1 parent 8d73b97 commit 74bef21

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

tests/run-macros/i17105.check

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1-
str_from_macro 1st 2nd
1+
test single: (1st case arg1) outside
2+
test curried: (2nd case arg1, arg2) outside

tests/run-macros/i17105/Macro_1.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ inline def testExpr(inline body: Any) = ${ testExprImpl('body) }
44
def testExprImpl(body: Expr[Any])(using Quotes): Expr[String] =
55
body match
66
case '{ def g(y: String) = "placeholder" + y; $a(g): String } =>
7-
'{ $a((z:String) => "str_from_macro " + z) }
7+
'{ $a((z: String) => s"(1st case ${z})") }
8+
case '{ def g(y: String)(z: String) = "placeholder" + y; $a(g): String } =>
9+
'{ $a((z1: String) => (z2: String) => s"(2nd case ${z1}, ${z2})") }
810
case _ => Expr("not matched")
911

1012
// TODO issue-17105: Clean this up if not neccessary

tests/run-macros/i17105/Test_2.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
@main def Test: Unit =
2-
println(testExpr { def f(x: String) = "placeholder" + x; f("1st") + " 2nd" })
2+
println("test single: " + testExpr { def f(x: String) = "placeholder" + x; f("arg1") + " outside" })
3+
println("test curried: " + testExpr { def f(x: String)(y: String) = "placeholder" + x; f("arg1")("args2") + " outside" })

0 commit comments

Comments
 (0)