phaller/scala — Issue #13: Method all on futures does not work properly
Author: vjovanov
Created: 2012-01-25 18:58:35+00:00
State: open

This snippet
val workerPromises : List[Promise[Results]]...

val resultFutures = workerPromises map (x => x.future)

blocking(
Future.all(resultFutures).map(_.map(_.results)).map(_.reduce(_ ++ _)),
Duration(3600 * 1000, TimeUnit.MILLISECONDS)
)

Fails the inferencer with:

[scalacfork] argument expression's type is not compatible with formal parameter type;
[scalacfork] found : List[scala.concurrent.akka.Promise[scala.tools.partest.nest.Results]]
[scalacfork] required: ?Coll

When I annotate the type like this:
val resultFutures: List[Future[Results]] = workerPromises map (x => x.future)

Then it fails because it can not find the implicit context:
[scalacfork] /home/vjovanov/work/devl/scala/scala/src/partest/scala/tools/partest/nest/DirectRunner.scala:87: error: could not find implicit value for parameter ec: scala.concurrent.ExecutionContext
[scalacfork] Future.all(resultFutures).map(_.map(_.results)).map(_.reduce(_ ++ _)),