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
If you have a future foo: Future[Unit] and do a await(foo) the compiler will give a warning:
foo: Future[Unit]
await(foo)
Warning:(258, 16) a pure expression does nothing in statement position; you may be omitting necessary parentheses await(foo) ^
Edit: This does not happen in all awaits on Future[Unit]s, as I initially assumed. Below is the minimal code I could get that reproduces this:
await
Future[Unit]
def foo(foobaz: Future[Unit]) = async { if ("".isEmpty) { await(foobaz) 0 } }
The text was updated successfully, but these errors were encountered:
+1
Sorry, something went wrong.
In scala 2.11, I get a very similar error message for
def checkForException(codeBlock: Any, finallyBlock: Any = ()): Any = { try { codeBlock } catch { ... } finally { finallyBlock } }
the warning is:
a pure expression does nothing in statement position; you may be omitting necessary parentheses [warn] finallyBlock
Update: I fixed my warning by changing the function signature to be: def checkForException(codeBlock: => Unit, finallyBlock: => Unit = ()): Any
def checkForException(codeBlock: => Unit, finallyBlock: => Unit = ()): Any
Successfully merging a pull request may close this issue.
If you have a future
foo: Future[Unit]
and do aawait(foo)
the compiler will give a warning:Edit: This does not happen in all
await
s onFuture[Unit]
s, as I initially assumed. Below is the minimal code I could get that reproduces this:The text was updated successfully, but these errors were encountered: