diff options
author | Paul Phillips <paulp@improving.org> | 2010-06-07 23:43:14 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2010-06-07 23:43:14 +0000 |
commit | caa6bf0e7a9c02b7519549c289f7a455bad281b1 (patch) | |
tree | ddd2a4da3fe7969776a039f8ccc44dd6aa2d4292 /test | |
parent | d6896c490acea8617247cf593060fa67ed82c79c (diff) | |
download | scala-caa6bf0e7a9c02b7519549c289f7a455bad281b1.tar.gz scala-caa6bf0e7a9c02b7519549c289f7a455bad281b1.tar.bz2 scala-caa6bf0e7a9c02b7519549c289f7a455bad281b1.zip |
Most of the iterate implementations were callin...
Most of the iterate implementations were calling the given function one
too many times, leading to tragic failure if the function could not
handle this (such as repeatedly applying tail.) Closes #3540, review by
prokopec.
Diffstat (limited to 'test')
-rw-r--r-- | test/files/run/bug3540.scala | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/test/files/run/bug3540.scala b/test/files/run/bug3540.scala new file mode 100644 index 0000000000..5ffacb5dff --- /dev/null +++ b/test/files/run/bug3540.scala @@ -0,0 +1,7 @@ +object Test { + def main(args: Array[String]): Unit = { + assert(List.iterate(List(1,2,3), 4)(_.tail).last.isEmpty) + assert(Stream.iterate(Stream(1,2,3), 4)(_.tail).last.isEmpty) + assert(Array.iterate(Array(1,2,3), 4)(_.tail).last.isEmpty) + } +} |