Skip to content

Commit c38b378

Browse files
committed
Add failing test case for contextual parameters
1 parent 0cffa8f commit c38b378

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

tests/run-macros/i17105/Macro_1.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ def testExprImpl(body: Expr[Any])(using Quotes): Expr[String] =
77
'{ $a((z: String) => s"[1st case] ${z}") }
88
case '{ def g(y: String)(z: String) = "placeholder" + y; $a(g): String } =>
99
'{ $a((z1: String) => (z2: String) => s"[2nd case] ${z1}, ${z2}") }
10+
case '{ given i: String = "given"; def g(using s: String) = "placeholder"; $a(g, i): String } =>
11+
'{ $a((s: String) => s"[3rd case] ${s}")(0) }
12+
/* TODO issue-17105: This causes type error due to another issue from issue-17105 */
13+
// case '{ def g(using s: String) = "placeholder"; $a(g) } =>
14+
// '{ $a((s: String) => s"[3rd case] ${s}") }
1015
case _ => Expr("not matched")
1116

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

tests/run-macros/i17105/Test_2.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@
33
println("case curried: " + testExpr { def f(x: String)(y: String) = "placeholder" + x; f("arg1")("arg2") + " outside" })
44
def outer() = " outer-method"
55
println("case methods from outer scope: " + testExpr { def f(x: String) = "placeholder" + x; f("arg1") + outer() })
6+
println("case contextual params: " + testExpr { given String = "given"; def f(using t: String) = "placeholder"; f + " outside" })

0 commit comments

Comments
 (0)