From d3f07fec16ad48a7b2ad13ed4508634c46b1e6bd Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Wed, 22 Sep 2021 11:14:56 +0200 Subject: [PATCH 1/2] Fix #10349: Add regression test --- tests/neg/10349.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 tests/neg/10349.scala diff --git a/tests/neg/10349.scala b/tests/neg/10349.scala new file mode 100644 index 000000000000..4ea683f6a8fb --- /dev/null +++ b/tests/neg/10349.scala @@ -0,0 +1,11 @@ +object Firsts: + + type First[X] = X match + case Map[_, v] => First[Option[v]] + + def first[X](x: X): First[X] = x match + case x: Map[_, _] => first(x.values.headOption) // error + + @main + def runFirsts2(): Unit = + assert(first(Map.empty[Int, Int]) == None) // error From ea0c0dd468fcbd9f6599c2a9fd4be5f44f75f74f Mon Sep 17 00:00:00 2001 From: Olivier Blanvillain Date: Wed, 22 Sep 2021 14:23:03 +0200 Subject: [PATCH 2/2] Remove 9849.scala, which fails on master --- tests/neg-custom-args/allow-deep-subtypes/9849.scala | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 tests/neg-custom-args/allow-deep-subtypes/9849.scala diff --git a/tests/neg-custom-args/allow-deep-subtypes/9849.scala b/tests/neg-custom-args/allow-deep-subtypes/9849.scala deleted file mode 100644 index d1e444f858d8..000000000000 --- a/tests/neg-custom-args/allow-deep-subtypes/9849.scala +++ /dev/null @@ -1,4 +0,0 @@ -type *:[A, B] = A match // error: Recursion limit exceeded. - case (B *: x) => A - case (x *: y) => x *: (B *: y) - case _ => A *: B