We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
-Wnonunit-statement
The scala-async macro does not work well together with the rather new scalac option -Wnonunit-statement (scala/scala#9893).
Example:
def test(): Future[Boolean] = async { await(Future.successful(true)) }
This will yield a warning:
unused value of type Boolean (add `: Unit` to discard silently) [warn] async {
Anything we can do about it?
The text was updated successfully, but these errors were encountered:
This seems to be related how markForAsyncTransform work in the scala compiler. The above expression desugars into the following:
markForAsyncTransform
{ final class stateMachine$async extends _root_.scala.async.FutureStateMachine { def <init>(): stateMachine$async = { stateMachine$async.super.<init>(scala.concurrent.ExecutionContext.Implicits.global); () }; override def apply(tr$async: scala.util.Try[AnyRef]): Unit = { scala.Predef.locally[Boolean](scala.async.Async.await[Boolean](scala.concurrent.Future.successful[Boolean](true))); () } }; (new stateMachine$async().start[Nothing](): scala.concurrent.Future[Boolean]) }
There we have an unused non-unit statement with the locally block which returns an unused Boolean.
locally
Boolean
Sorry, something went wrong.
Fixed on the transform side, which is more general.
No branches or pull requests
The scala-async macro does not work well together with the rather new scalac option
-Wnonunit-statement
(scala/scala#9893).Example:
This will yield a warning:
Anything we can do about it?
The text was updated successfully, but these errors were encountered: