Skip to content

Compiler warns about "pure expression does nothing in statement position" #157

Closed
@orium

Description

@orium

If you have a future foo: Future[Unit] and do a await(foo) the compiler will give a warning:

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:

def foo(foobaz: Future[Unit]) =
  async {
    if ("".isEmpty) {
      await(foobaz)
      0
    }
  }

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