diff options
author | Paul Phillips <paulp@improving.org> | 2014-01-25 16:42:03 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2014-01-25 16:42:03 -0800 |
commit | 97d14c5cd6ec44c46f6084111b3a55ebf8b1d109 (patch) | |
tree | cf1e5e1049e328c3048391d2716fb14ff79792a6 | |
parent | 84a4f64cc68e776ea92d601afcf0cf5a3f8d1e69 (diff) | |
download | scala-97d14c5cd6ec44c46f6084111b3a55ebf8b1d109.tar.gz scala-97d14c5cd6ec44c46f6084111b3a55ebf8b1d109.tar.bz2 scala-97d14c5cd6ec44c46f6084111b3a55ebf8b1d109.zip |
Fix misuse of underscores.
It's a language bug, but M[_] <: Foo[_] does not mean what
anyone who writes it believes that it means. You have to give
the type parameter a name, like M[X] <: Foo[X].
-rw-r--r-- | src/library/scala/concurrent/Future.scala | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/library/scala/concurrent/Future.scala b/src/library/scala/concurrent/Future.scala index d271c4cdeb..4ed0687334 100644 --- a/src/library/scala/concurrent/Future.scala +++ b/src/library/scala/concurrent/Future.scala @@ -494,9 +494,9 @@ object Future { /** Simple version of `Future.traverse`. Transforms a `TraversableOnce[Future[A]]` into a `Future[TraversableOnce[A]]`. * Useful for reducing many `Future`s into a single `Future`. */ - def sequence[A, M[_] <: TraversableOnce[_]](in: M[Future[A]])(implicit cbf: CanBuildFrom[M[Future[A]], A, M[A]], executor: ExecutionContext): Future[M[A]] = { + def sequence[A, M[X] <: TraversableOnce[X]](in: M[Future[A]])(implicit cbf: CanBuildFrom[M[Future[A]], A, M[A]], executor: ExecutionContext): Future[M[A]] = { in.foldLeft(successful(cbf(in))) { - (fr, fa) => for (r <- fr; a <- fa.asInstanceOf[Future[A]]) yield (r += a) + (fr, fa) => for (r <- fr; a <- fa) yield (r += a) } map (_.result()) } @@ -569,9 +569,9 @@ object Future { * val myFutureList = Future.traverse(myList)(x => Future(myFunc(x))) * }}} */ - def traverse[A, B, M[_] <: TraversableOnce[_]](in: M[A])(fn: A => Future[B])(implicit cbf: CanBuildFrom[M[A], B, M[B]], executor: ExecutionContext): Future[M[B]] = + def traverse[A, B, M[X] <: TraversableOnce[X]](in: M[A])(fn: A => Future[B])(implicit cbf: CanBuildFrom[M[A], B, M[B]], executor: ExecutionContext): Future[M[B]] = in.foldLeft(successful(cbf(in))) { (fr, a) => - val fb = fn(a.asInstanceOf[A]) + val fb = fn(a) for (r <- fr; b <- fb) yield (r += b) }.map(_.result()) |