From d832346268779090f08afad649a337ca571efc37 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Tue, 22 Mar 2016 10:31:32 +0100 Subject: SI-9488 - adds the same default toString format to Scala Futures as 2.12.x Includes tests to verify the toString representations. --- src/library/scala/concurrent/impl/Promise.scala | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src') diff --git a/src/library/scala/concurrent/impl/Promise.scala b/src/library/scala/concurrent/impl/Promise.scala index b15601058e..6d2fc5c87c 100644 --- a/src/library/scala/concurrent/impl/Promise.scala +++ b/src/library/scala/concurrent/impl/Promise.scala @@ -19,6 +19,10 @@ import java.util.concurrent.locks.AbstractQueuedSynchronizer private[concurrent] trait Promise[T] extends scala.concurrent.Promise[T] with scala.concurrent.Future[T] { def future: this.type = this + override def toString: String = value match { + case Some(result) => "Future("+result+")" + case None => "Future()" + } } /* Precondition: `executor` is prepared, i.e., `executor` has been returned from invocation of `prepare` on some other `ExecutionContext`. -- cgit v1.2.3