fixed t341

git-svn-id: http://lampsvn.epfl.ch/svn-repos/scala/scala/trunk@13707 5e8d7ff9-d8ef-0310-90f0-a4852d11357a
This commit is contained in:
emir 2008-01-15 23:18:08 +00:00
parent ac98e96e2c
commit 26aee9a4ac
2 changed files with 6 additions and 1 deletions

View File

@ -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]

View File

@ -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"))
}
}