From ff66369083e3e0e23acca8860c69303fed893860 Mon Sep 17 00:00:00 2001 From: Jamie Thompson Date: Fri, 16 Oct 2020 11:40:11 +0200 Subject: [PATCH] fix #8344: add regression tests --- tests/pos/i8344-1.scala | 11 +++++++++++ tests/pos/i8344-2.scala | 8 ++++++++ 2 files changed, 19 insertions(+) create mode 100644 tests/pos/i8344-1.scala create mode 100644 tests/pos/i8344-2.scala diff --git a/tests/pos/i8344-1.scala b/tests/pos/i8344-1.scala new file mode 100644 index 000000000000..48aae05e38b2 --- /dev/null +++ b/tests/pos/i8344-1.scala @@ -0,0 +1,11 @@ +import scala.{Tuple => STuple} + +enum Datatype[T] { + case Tuple[T <: STuple](elems: STuple.Map[T, Datatype]) extends Datatype[T] +} + +object Datatype { + given [H, T <: STuple](using ht: Datatype[H], tt: Datatype[T]) as Datatype[H *: T] = tt match { + case Datatype.Tuple(elems) => Datatype.Tuple(ht *: elems) + } +} diff --git a/tests/pos/i8344-2.scala b/tests/pos/i8344-2.scala new file mode 100644 index 000000000000..9c4988815edd --- /dev/null +++ b/tests/pos/i8344-2.scala @@ -0,0 +1,8 @@ +sealed trait Datatype[T] +case class Foo[T <: Tuple](elems: Tuple.Map[T, Datatype]) extends Datatype[T] + +def g = + val tt: Datatype[_] = ??? + tt match { + case Foo(_) => ??? + }