Skip to content

Commit 735dbef

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 89e316e commit 735dbef

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
@@ -581,7 +581,7 @@ object SpaceEngine {
581581
var resTp0 = mt.resultType
582582
if mt.isResultDependent then
583583
resTp0 = ctx.typeAssigner.safeSubstParam(resTp0, mt.paramRefs.head, scrutineeTp)
584-
val resTp = wildApprox(resTp0.finalResultType)
584+
val resTp = wildApprox(resTp0.finalResultType).stripNamedTuple
585585

586586
val sig =
587587
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)