From 2477bbd9d64df3dbfac063e1fc71115daf0f3ea7 Mon Sep 17 00:00:00 2001 From: Erik Osheim Date: Tue, 24 Dec 2013 15:52:17 -0500 Subject: SI-8100 - prevent possible SOE during Stream#flatten. This commit changes stream flatten to avoid allocating a stack frame for every stream item. Previously, flattening a stream whose elements are mostly empty would result in a StackOverflowException. This commit also adds a test demonstrating the problem. --- src/library/scala/collection/immutable/Stream.scala | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/library') diff --git a/src/library/scala/collection/immutable/Stream.scala b/src/library/scala/collection/immutable/Stream.scala index 5e1de44749..e6e4d6ec18 100644 --- a/src/library/scala/collection/immutable/Stream.scala +++ b/src/library/scala/collection/immutable/Stream.scala @@ -960,14 +960,16 @@ self => * }}} */ override def flatten[B](implicit asTraversable: A => /*<: