Skip to content

CFE allows await voidExpression. #40685

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

Closed
lrhn opened this issue Feb 19, 2020 · 1 comment
Closed

CFE allows await voidExpression. #40685

lrhn opened this issue Feb 19, 2020 · 1 comment
Labels
front-end-missing-error legacy-area-front-end Legacy: Use area-dart-model instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@lrhn
Copy link
Member

lrhn commented Feb 19, 2020

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.

@lrhn lrhn added type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) legacy-area-front-end Legacy: Use area-dart-model instead. front-end-missing-error labels Feb 19, 2020
@eernstg
Copy link
Member

eernstg commented Feb 19, 2020

We still agree that it would be nice to make this an error, but we decided that it is not an error (the breakage was more substantial than anticipated). I'll update the language specification to be aligned with this, noting that a tool is very welcome to issue a hint.

@eernstg eernstg closed this as completed Feb 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
front-end-missing-error legacy-area-front-end Legacy: Use area-dart-model instead. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

2 participants