scala/scala-async

a pure expression does nothing in statement position

exp0nge opened this issue · 0 comments

Similar to /issues/74

Here's the code snippet:

import scala.async.Async._
import scala.concurrent.Future
import scala.concurrent.ExecutionContext.Implicits.global


def doStuff(v: Any): Any = {
  v
}

def main() {
  async {
    val s = if (1 == 1) {
      await(Future{doStuff(true)})
      await(Future{doStuff(10)})
      s"true"
    } else {
      s"false"
    }
    println(s)
  }
}

main()

Assigning the futures to a val will not throw the warning.