diff options
author | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-06-01 16:15:40 +0000 |
---|---|---|
committer | Aleksandar Pokopec <aleksandar.prokopec@epfl.ch> | 2010-06-01 16:15:40 +0000 |
commit | 8acca208ae541e44f306a50c210e2626f571332b (patch) | |
tree | 31d42d75e6c93e4b5c443b3c9da8d10605898f6c | |
parent | 6e3814fe9e5c61601db81f6a46f3f5147c6c0e5f (diff) | |
download | scala-8acca208ae541e44f306a50c210e2626f571332b.tar.gz scala-8acca208ae541e44f306a50c210e2626f571332b.tar.bz2 scala-8acca208ae541e44f306a50c210e2626f571332b.zip |
Fixes #3496. No review.
-rw-r--r-- | src/library/scala/collection/immutable/Stream.scala | 2 | ||||
-rw-r--r-- | test/files/pos/t3496.scala | 15 |
2 files changed, 17 insertions, 0 deletions
diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala index 7e363a7e96..9ad7a49e2a 100644 --- a/src/library/scala/collection/immutable/Stream.scala +++ b/src/library/scala/collection/immutable/Stream.scala @@ -344,6 +344,8 @@ self => if (n <= 0 || isEmpty) Stream.Empty else new Stream.Cons(head, if (n == 1) Stream.empty else tail take (n-1)) + override def splitAt(n: Int): (Stream[A], Stream[A]) = (take(n), drop(n)) + /** A substream starting at index `from` * and extending up to (but not including) index `until`. * diff --git a/test/files/pos/t3496.scala b/test/files/pos/t3496.scala new file mode 100644 index 0000000000..e1aa032ab1 --- /dev/null +++ b/test/files/pos/t3496.scala @@ -0,0 +1,15 @@ + + + + +// ticket #3496 +object Test { + + def main(args: Array[String]) { + val s = Stream.from(1) + s.take(5) + s.drop(5) + s.splitAt(5) + } + +} |