Closed
Description
On Scala 2.11, async 0.9.1, this code works fine but produces a compiler warning:
a pure expression does nothing in statement position; you may be omitting necessary parentheses
await(Future{println("hello")})
^
import scala.async.Async._
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global
import scala.util.Random
object AsyncTest {
def randBool = (new Random).nextBoolean()
def doStuffWithSideEffect(): String = {
println("goodbye")
"foo"
}
def test() {
async {
if (randBool) {
await(Future{println("hello")})
doStuffWithSideEffect()
}
}
}
}
Unless I'm mistaken, this warning shouldn't be there - that is, it doesn't appear if you write a synchronous function with a similar pattern.