summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-07-05 09:25:39 +0000
committerAleksandar Pokopec <aleksandar.prokopec@epfl.ch>2010-07-05 09:25:39 +0000
commit4db294103175cc0789ac63168c7308b3542ee184 (patch)
treeeaab42d4a71271283237211b9003d5a797148a61
parent302b1df81fcac0648defe7a0dd651f6eba063c58 (diff)
downloadscala-4db294103175cc0789ac63168c7308b3542ee184.tar.gz
scala-4db294103175cc0789ac63168c7308b3542ee184.tar.bz2
scala-4db294103175cc0789ac63168c7308b3542ee184.zip
Fixes #3580. Review by extempore.
-rw-r--r--src/library/scala/collection/TraversableLike.scala2
-rw-r--r--test/files/run/t3580.scala17
2 files changed, 18 insertions, 1 deletions
diff --git a/src/library/scala/collection/TraversableLike.scala b/src/library/scala/collection/TraversableLike.scala
index 2169dcdd02..6f851fb5e7 100644
--- a/src/library/scala/collection/TraversableLike.scala
+++ b/src/library/scala/collection/TraversableLike.scala
@@ -698,7 +698,7 @@ trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr]
def toTraversable: Traversable[A] = thisCollection
def toIterator: Iterator[A] = toStream.iterator
- def toStream: Stream[A] = Stream.empty[A] ++ thisCollection
+ def toStream: Stream[A] = toBuffer.toStream
/** Converts this $coll to a string.
* @return a string representation of this collection. By default this
diff --git a/test/files/run/t3580.scala b/test/files/run/t3580.scala
new file mode 100644
index 0000000000..50ff6c4551
--- /dev/null
+++ b/test/files/run/t3580.scala
@@ -0,0 +1,17 @@
+
+
+
+
+
+object Test {
+
+ class Empty extends Traversable[Nothing] {
+ def foreach[U](f: Nothing => U) {}
+ }
+
+ def main(args: Array[String]) {
+ val t = new Empty
+ t.toStream
+ }
+
+}