Skip to content

CFE allows await voidExpression. #40685

Closed
@lrhn

Description

@lrhn

The language specification allows void-typed expressions to occur only in an enumerated number of syntactical positions. Those do not include await voidExpression.

If you do:

void foo() {}
void main() {
  await foo();
}

it should be a compile-time error, but it is accepted by both the front-end and the analyzer (the latter with a hint about awaiting a non-future).

The spec says:

The occurrence of an expression of type \VOID{} is a compile-time error unless it is permitted according to one of the following rules.

and then goes on to list the rules which do not include await. So, the code above should be a compile-time error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    front-end-missing-errorlegacy-area-front-endLegacy: Use area-dart-model instead.type-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions