scala/scala — pull request #3089 by retronym (2013-10-31 10:55:01+00:00)
Title: Collections: remove redundant calls to .seq

Students of Scala's history might recall that at introduction of
parallel collections, GenIterable et al were *not* added; instead
the parallel collections inherited from the existing interfaces.

This of course was an invitation to widespread disaster as any
existing code that foreach-ed over a collection might now experience
unwanted concurrency.

The first attempt to fix this was to add the `.seq` method to
convert a parallel colleciton to a sequential one. This was added
in e579152f732, and call sites in the standard library with
side-effecting foreach calls were changed to use that.

But this was (rightly) deemed inadequate, as we could hardly expect
people to change existing code or remember to do this in new code.

So later, in 3de96153e5b, GenIterable was sprouted, and parallel
collections were re-parented.

This commit removes residual needless calls to .seq when the static
type of the receiver is already a plain Iterable, which are no-ops.

Review by @axel22 @rexkerr