Skip to content

a pure expression does nothing in statement position #202

Closed
@exp0nge

Description

@exp0nge

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions