Skip to content
New issue

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

a pure expression does nothing in statement position #202

Closed
exp0nge opened this issue Oct 10, 2018 · 0 comments · Fixed by #237
Closed

a pure expression does nothing in statement position #202

exp0nge opened this issue Oct 10, 2018 · 0 comments · Fixed by #237
Milestone

Comments

@exp0nge
Copy link

exp0nge commented Oct 10, 2018

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.

@exp0nge exp0nge changed the title Spurious warning when used in unit function a pure expression does nothing in statement position Oct 10, 2018
@retronym retronym added this to the 1.0 milestone Jun 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants