From 1d4a1f721d360c73b9f2468368c7e9b2b4c17fea Mon Sep 17 00:00:00 2001 From: Rex Kerr Date: Wed, 18 Feb 2015 18:52:46 -0800 Subject: SI-9126 Missing .seqs causes problems with parallel GenXs Added `.seq` in two essential places so that a parallel collection passed as an argument won't mess up side-effecting sequential computations in `List.flatMap` and `GenericTraversableTemplate.transpose` (thanks to retronym for finding the danger spots). Tests that `.seq` is called by constructing a `GenSeq` whose `.seq` disagrees with anything non-`.seq` (idea & working implementation from retronym). Also updates the `.seq` test for `Vector#++` to use the new more efficient method. --- src/library/scala/collection/immutable/List.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/library/scala/collection/immutable/List.scala') diff --git a/src/library/scala/collection/immutable/List.scala b/src/library/scala/collection/immutable/List.scala index a46b4adabb..254f14f13c 100644 --- a/src/library/scala/collection/immutable/List.scala +++ b/src/library/scala/collection/immutable/List.scala @@ -324,7 +324,7 @@ sealed abstract class List[+A] extends AbstractSeq[A] var h: ::[B] = null var t: ::[B] = null while (rest ne Nil) { - f(rest.head).foreach{ b => + f(rest.head).seq.foreach{ b => if (!found) { h = new ::(b, Nil) t = h -- cgit v1.2.3