diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-10-21 09:55:43 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-10-21 09:55:43 +0200 |
commit | bff11b611ae4c9a02c456847fbbb4695bc3f40ec (patch) | |
tree | eb151b6c756e62a327accf8565d307137002efb9 /src/library | |
parent | 5f894c06da97fdcebf206ac41b4694beb7b27a05 (diff) | |
parent | afa6592ec054ce1ffd38e89bb251032e85f6ff6e (diff) | |
download | scala-bff11b611ae4c9a02c456847fbbb4695bc3f40ec.tar.gz scala-bff11b611ae4c9a02c456847fbbb4695bc3f40ec.tar.bz2 scala-bff11b611ae4c9a02c456847fbbb4695bc3f40ec.zip |
Merge pull request #5451 from lifuhuang/patch-1
Replace deprecated conforms
Diffstat (limited to 'src/library')
-rw-r--r-- | src/library/scala/concurrent/Future.scala | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/library/scala/concurrent/Future.scala b/src/library/scala/concurrent/Future.scala index c0398605a6..6c1c9a0c80 100644 --- a/src/library/scala/concurrent/Future.scala +++ b/src/library/scala/concurrent/Future.scala @@ -116,7 +116,7 @@ trait Future[+T] extends Awaitable[T] { @deprecated("use `foreach` or `onComplete` instead (keep in mind that they take total rather than partial functions)", "2.12.0") def onSuccess[U](pf: PartialFunction[T, U])(implicit executor: ExecutionContext): Unit = onComplete { case Success(v) => - pf.applyOrElse[T, Any](v, Predef.conforms[T]) // Exploiting the cached function to avoid MatchError + pf.applyOrElse[T, Any](v, Predef.identity[T]) // Exploiting the cached function to avoid MatchError case _ => } @@ -141,7 +141,7 @@ trait Future[+T] extends Awaitable[T] { @deprecated("use `onComplete` or `failed.foreach` instead (keep in mind that they take total rather than partial functions)", "2.12.0") def onFailure[U](@deprecatedName('callback) pf: PartialFunction[Throwable, U])(implicit executor: ExecutionContext): Unit = onComplete { case Failure(t) => - pf.applyOrElse[Throwable, Any](t, Predef.conforms[Throwable]) // Exploiting the cached function to avoid MatchError + pf.applyOrElse[Throwable, Any](t, Predef.identity[Throwable]) // Exploiting the cached function to avoid MatchError case _ => } @@ -528,7 +528,7 @@ trait Future[+T] extends Awaitable[T] { def andThen[U](pf: PartialFunction[Try[T], U])(implicit executor: ExecutionContext): Future[T] = transform { result => - try pf.applyOrElse[Try[T], Any](result, Predef.conforms[Try[T]]) + try pf.applyOrElse[Try[T], Any](result, Predef.identity[Try[T]]) catch { case NonFatal(t) => executor reportFailure t } result |