Skip to content

Commit b25e952

Browse files
committed
add tuple test to patmat check
1 parent 89e8ff9 commit b25e952

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,13 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
302302
}
303303

304304
// refine path-dependent type in params. refer to t9672
305-
meth.firstParamTypes.map(_.stripTypeVar).map(refine(tp, _))
305+
meth.firstParamTypes.map(_.stripTypeVar).map { ptp =>
306+
(tp, ptp) match {
307+
case (TypeRef(ref1: TypeProxy, _), TypeRef(ref2: TypeProxy, name)) =>
308+
if (ref1.underlying <:< ref2.underlying) TypeRef(ref1, name) else ptp
309+
case _ => ptp
310+
}
311+
}
306312
}
307313

308314
def partitions(tp: Type): List[Space] = {

tests/patmat/tuple.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
object Test {
2+
(4, (4, 6)) match {
3+
case (x, (y, z)) => true
4+
}
5+
}

0 commit comments

Comments
 (0)