diff --git a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala index 2baae092a1f3..2dc3963bb870 100644 --- a/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala +++ b/compiler/src/dotty/tools/dotc/transform/patmat/Space.scala @@ -537,7 +537,7 @@ object SpaceEngine { scrutineeTp match case AppliedType(tycon, targs) if unappSym.is(Synthetic) - && (pt.resultType.asInstanceOf[MethodType].paramInfos.head.typeConstructor eq tycon) => + && (pt.resultType.asInstanceOf[MethodType].paramInfos.head.typeConstructor =:= tycon) => // Special case synthetic unapply/unapplySeq's // Provided the shapes of the types match: // the scrutinee type being unapplied and diff --git a/tests/pos/i23817/file_1.scala b/tests/pos/i23817/file_1.scala new file mode 100644 index 000000000000..c421058797bf --- /dev/null +++ b/tests/pos/i23817/file_1.scala @@ -0,0 +1,2 @@ +sealed trait N[T] +case class MakeTuple[T <: Tuple](v: T) extends N[T] diff --git a/tests/pos/i23817/file_2.scala b/tests/pos/i23817/file_2.scala new file mode 100644 index 000000000000..63958a17cdb1 --- /dev/null +++ b/tests/pos/i23817/file_2.scala @@ -0,0 +1,6 @@ +object test { + def t[T](expr: N[T]): Any = + expr match { + case MakeTuple(_) => ??? + } +} diff --git a/tests/pos/i23817_2/file_1.scala b/tests/pos/i23817_2/file_1.scala new file mode 100644 index 000000000000..cc7737cde5a1 --- /dev/null +++ b/tests/pos/i23817_2/file_1.scala @@ -0,0 +1,3 @@ +trait TC2[X] +sealed trait TC1[T] +case class Iterable[T, C <: scala.Iterable[T]](tag: TC1[C]) extends TC1[C] diff --git a/tests/pos/i23817_2/file_2.scala b/tests/pos/i23817_2/file_2.scala new file mode 100644 index 000000000000..cafa8535af58 --- /dev/null +++ b/tests/pos/i23817_2/file_2.scala @@ -0,0 +1,6 @@ +object test { + def f[T](c: TC1[T]): Unit = + c match { + case Iterable(_) => ??? + } +}