summaryrefslogtreecommitdiff
path: root/src/library/scalax/collection/immutable/List.scala
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@epfl.ch>2009-02-10 09:32:05 +0000
committerLukas Rytz <lukas.rytz@epfl.ch>2009-02-10 09:32:05 +0000
commitb0bcd0a40d209e02cd8bbabedc5819f6ce8108ef (patch)
tree953a187b3c51ab55e0765560f41030f7a01f3ee7 /src/library/scalax/collection/immutable/List.scala
parent76009173e08545c346d4a66eb847a75120649ad2 (diff)
downloadscala-b0bcd0a40d209e02cd8bbabedc5819f6ce8108ef.tar.gz
scala-b0bcd0a40d209e02cd8bbabedc5819f6ce8108ef.tar.bz2
scala-b0bcd0a40d209e02cd8bbabedc5819f6ce8108ef.zip
fix for #1691
Diffstat (limited to 'src/library/scalax/collection/immutable/List.scala')
-rw-r--r--src/library/scalax/collection/immutable/List.scala9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/library/scalax/collection/immutable/List.scala b/src/library/scalax/collection/immutable/List.scala
index bed0ab96f5..6851fb9769 100644
--- a/src/library/scalax/collection/immutable/List.scala
+++ b/src/library/scalax/collection/immutable/List.scala
@@ -589,7 +589,9 @@ object List extends SequenceFactory[List] {
* @deprecated use @see iterate instead.
* @param start the start value of the list
* @param end the end value of the list
- * @param step the increment function of the list, must be monotonically increasing or decreasing
+ * @param step the increment function of the list, which given <code>v<sub>n</sub></code>,
+ * computes <code>v<sub>n+1</sub></code>. Must be monotonically increasing
+ * or decreasing.
* @return the sorted list of all integers in range [start;end).
*/
@deprecated def range(start: Int, end: Int, step: Int => Int): List[Int] = {
@@ -599,7 +601,10 @@ object List extends SequenceFactory[List] {
var i = start
while ((!up || i < end) && (!down || i > end)) {
b += i
- i += step(i)
+ val next = step(i)
+ if (i == next)
+ throw new IllegalArgumentException("the step function did not make any progress on "+ i)
+ i = next
}
b.toList
}