-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mapping futures succeeds typecheck when it shouldn't #9822
Comments
Imported From: https://issues.scala-lang.org/browse/SI-9822?orig=1 |
@som-snytt said: $ scala -Ywarn-value-discard
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_60).
Type in expressions for evaluation. Or try :help.
scala> import concurrent._, ExecutionContext.Implicits._
import concurrent._
import ExecutionContext.Implicits._
scala> def f1 = Future.successful(())
f1: scala.concurrent.Future[Unit]
scala> def f2 = Future.successful(())
f2: scala.concurrent.Future[Unit]
scala> f1 map (_ => f2)
res0: scala.concurrent.Future[scala.concurrent.Future[Unit]] = Success(scala.concurrent.impl.Promise$KeptPromise@258e2e41)
scala> def f3: Future[Unit] = f1 map (_ => f2)
<console>:19: warning: discarded non-Unit value
def f3: Future[Unit] = f1 map (_ => f2)
^
f3: scala.concurrent.Future[Unit] Include -Xfatal-warnings to lock it down. |
Sarunas Valaskevicius (rakatan) said: |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
the body of the test function returns
Future[Future[Unit]]
, however, the compiler is happy to say that it is simply aFuture[Unit]
, which leads to errors in codeThe text was updated successfully, but these errors were encountered: