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 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