Skip to content
Prev Previous commit
Next Next commit
add tuple test to patmat check
  • Loading branch information
liufengyun committed Jul 5, 2016
commit b25e9526cbc43e5a5d7c5c07715d157a5bc0ac82
8 changes: 7 additions & 1 deletion src/dotty/tools/dotc/transform/patmat/Space.scala
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,13 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
}

// refine path-dependent type in params. refer to t9672
meth.firstParamTypes.map(_.stripTypeVar).map(refine(tp, _))
meth.firstParamTypes.map(_.stripTypeVar).map { ptp =>
(tp, ptp) match {
case (TypeRef(ref1: TypeProxy, _), TypeRef(ref2: TypeProxy, name)) =>
if (ref1.underlying <:< ref2.underlying) TypeRef(ref1, name) else ptp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here. this is kind-of asSeenFrom.

case _ => ptp
}
}
}

def partitions(tp: Type): List[Space] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

decompose

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a comment that says that there is an assumption that canDecompose(tp)

Expand Down
5 changes: 5 additions & 0 deletions tests/patmat/tuple.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
object Test {
(4, (4, 6)) match {
case (x, (y, z)) => true
}
}