Skip to content

Commit 8fb7cfe

Browse files
committed
Add testcase with contravariant type params
1 parent 967e04a commit 8fb7cfe

File tree

3 files changed

+4
-0
lines changed

3 files changed

+4
-0
lines changed

tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function.check

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ case 4 matched => truthy
44
case 5 matchd => 1
55
case 7 matchd => 1
66
case 8 matched => (1,str)
7+
case 9 matched => zero

tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function/Macro_1.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,6 @@ def testExprImpl1(body: Expr[Any])(using Quotes): Expr[String] =
1717
'{ "case 7 matchd => " + $a[Int](List(1, 2, 3), 2) }
1818
case '{ [A] => (x : A) => [B] => (y : B) => $a[A, B](x, y) : (A, B) } =>
1919
'{ "case 8 matched => " + $a[Int, String](1, "str")}
20+
case '{ [A, B] => (x : Map[A, B], y: A) => $a[A, B](x, y) : Option[B] } =>
21+
'{ "case 9 matched => " + $a[Int, String](Map(0 -> "zero", 1 -> "one"), 0).getOrElse("failed") }
2022
case _ => Expr("not matched")

tests/run-custom-args/quoted-pattern-poly/quote-match-poly-function/Test_2.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,4 @@
55
println(testExpr([C, D] => (x : C, f : C => D) => f(x))) // Should match case 4
66
println(testExpr([B] => (x : List[B], y : B) => x.indexOf(y))) // Should match case 7
77
println(testExpr([B] => (x : B) => [C] => (y : C) => (x, y))) // Should match case 8
8+
println(testExpr([C, D] => (x : Map[C, D], y: C) => x.get(y)))

0 commit comments

Comments
 (0)