summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/library/scala/collection/immutable/Stream.scala4
-rw-r--r--test/files/run/t3496.scala (renamed from test/files/pos/t3496.scala)0
-rw-r--r--test/files/run/t3508.scala11
3 files changed, 13 insertions, 2 deletions
diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala
index 9610afb8cd..7660a1e2c8 100644
--- a/src/library/scala/collection/immutable/Stream.scala
+++ b/src/library/scala/collection/immutable/Stream.scala
@@ -609,8 +609,8 @@ object Stream extends SeqFactory[Stream] {
if (n <= 0) Empty else new Cons(elem, fill(n-1)(elem))
override def tabulate[A](n: Int)(f: Int => A): Stream[A] = {
- def loop(i: Int) =
- if (i >= n) Empty else new Cons(f(i), tabulate(i+1)(f))
+ def loop(i: Int): Stream[A] =
+ if (i >= n) Empty else new Cons(f(i), loop(i+1))
loop(0)
}
diff --git a/test/files/pos/t3496.scala b/test/files/run/t3496.scala
index e1aa032ab1..e1aa032ab1 100644
--- a/test/files/pos/t3496.scala
+++ b/test/files/run/t3496.scala
diff --git a/test/files/run/t3508.scala b/test/files/run/t3508.scala
new file mode 100644
index 0000000000..01d976ba0d
--- /dev/null
+++ b/test/files/run/t3508.scala
@@ -0,0 +1,11 @@
+
+
+import collection.immutable._
+
+
+// ticket #3508
+object Test {
+ def main(args: Array[String]) {
+ assert(Stream.tabulate(123)(_ + 1).toList == List.tabulate(123)(_ + 1))
+ }
+}