From 6df0408f3c4ed2712bfe62d115ae6d6355b4f23b Mon Sep 17 00:00:00 2001 From: Sean McDirmid Date: Mon, 21 May 2007 13:46:29 +0000 Subject: Fixing broken test, seems like until was not ta... Fixing broken test, seems like until was not taking into account step direction --- src/library/scala/runtime/RichInt.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/library') diff --git a/src/library/scala/runtime/RichInt.scala b/src/library/scala/runtime/RichInt.scala index dfa47dbedc..d78b7cc4e2 100644 --- a/src/library/scala/runtime/RichInt.scala +++ b/src/library/scala/runtime/RichInt.scala @@ -18,8 +18,11 @@ final class RichInt(x: Int) extends Proxy with Ordered[Int] { // Ordered[Int] def compare (y: Int): Int = if (x < y) -1 else if (x > y) 1 else 0 - def until(y: Int): Iterator[Int] = Iterator.range(x, y) - def to(y: Int): Iterator[Int] = Iterator.range(x, y + 1) + def until(y: Int): Iterator[Int] = { + if (y > x) Iterator.range(x, y, +1) + else Iterator.range(x, y, -1) + } + def to(y: Int): Iterator[Int] = until(y + 1) def min(y: Int): Int = if (x < y) x else y def max(y: Int): Int = if (x > y) x else y -- cgit v1.2.3