Skip to content

Commit 8c256ff

Browse files
committed
Fix issue 23158
The fix is made based on us doing stripNamedTuple in other parts close by. Seems like made should in a single place, but I lack the bigger understanding to figure our where that would be.
1 parent 4d50e5f commit 8c256ff

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

compiler/src/dotty/tools/dotc/transform/patmat/Space.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ object SpaceEngine {
570570
// Case unapplySeq:
571571
// 1. return the type `List[T]` where `T` is the element type of the unapplySeq return type `Seq[T]`
572572

573-
val resTp = wildApprox(ctx.typeAssigner.safeSubstMethodParams(mt, scrutineeTp :: Nil).finalResultType)
573+
val resTp = wildApprox(ctx.typeAssigner.safeSubstMethodParams(mt, scrutineeTp :: Nil).finalResultType).stripNamedTuple
574574

575575
val sig =
576576
if (resTp.isRef(defn.BooleanClass))

tests/pos/i23158.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
//> using options -Werror
2+
3+
object Unpack {
4+
final case class Pair(a: Int, b: Int)
5+
def unapply(e: Pair): NamedTuple.NamedTuple[("a", "b"), (Int, Int)] = ???
6+
7+
val x: Pair = ???
8+
x match {
9+
case Unpack(_, _) => ???
10+
}
11+
}

0 commit comments

Comments
 (0)