diff --git a/compiler/src/dotty/tools/dotc/core/TypeUtils.scala b/compiler/src/dotty/tools/dotc/core/TypeUtils.scala index 594249065d98..ff366c120de0 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeUtils.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeUtils.scala @@ -156,7 +156,7 @@ class TypeUtils: else self - def isNamedTupleType(using Context): Boolean = self match + def isNamedTupleType(using Context): Boolean = self.normalized.dealias match case defn.NamedTuple(_, _) => true case _ => false diff --git a/tests/neg/i23552.scala b/tests/pos/i23552.scala similarity index 100% rename from tests/neg/i23552.scala rename to tests/pos/i23552.scala diff --git a/tests/pos/i24504.scala b/tests/pos/i24504.scala new file mode 100644 index 000000000000..ad5b700130cf --- /dev/null +++ b/tests/pos/i24504.scala @@ -0,0 +1,12 @@ +object Unpack { + trait Expr[T] { + type Fields = NamedTuple.From[T] + } + final case class Pair(a: Int, b: Int) + def unapply(e: Expr[Pair]): e.Fields = ??? + + val x: Expr[Pair] = ??? + x match { + case Unpack(_, _) => ??? + } +}