summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/compiler/scala/tools/nsc/matching/ParallelMatching.scala2
-rw-r--r--test/files/run/patmatnew.scala5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
index ca3eef96a0..d019b4cc89 100644
--- a/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
+++ b/src/compiler/scala/tools/nsc/matching/ParallelMatching.scala
@@ -541,7 +541,7 @@ trait ParallelMatching {
ys = ys.tail
}
val tail = newVar(scrutinee.pos, sequenceType)
- bindings += typedValDef(tail, {if (ix-1>0) seqDrop(treeAsSeq.duplicate, ix) else mkIdent(scrutinee)})
+ bindings += typedValDef(tail, {if (ix > 0) seqDrop(treeAsSeq.duplicate, ix) else mkIdent(scrutinee)})
val nrows = new ListBuffer[Row]
diff --git a/test/files/run/patmatnew.scala b/test/files/run/patmatnew.scala
index 3580e561e8..77727060da 100644
--- a/test/files/run/patmatnew.scala
+++ b/test/files/run/patmatnew.scala
@@ -165,11 +165,16 @@ object Test extends TestConsoleMain {
def doMatch(xs: List[String]): String = xs match {
case List(_*) => "ok"
}
+ def doMatch2(xs: List[String]): List[String] = xs match {
+ case List(_, rest @ _*) => rest.toList
+ }
override def runTest() {
val list1 = List()
assertEquals(doMatch(list1), "ok")
val list2 = List("1","2","3")
assertEquals(doMatch(list2), "ok")
+ val list3 = List("1","2","3")
+ assertEquals(doMatch2(list3), List("2","3"))
}
}