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

Make it an error to await voidExpression #932

Closed
eernstg opened this issue Apr 17, 2020 · 6 comments
Closed

Make it an error to await voidExpression #932

eernstg opened this issue Apr 17, 2020 · 6 comments
Labels
feature Proposed language feature that solves one or more problems nnbd NNBD related issues

Comments

@eernstg
Copy link
Member

eernstg commented Apr 17, 2020

For the release of Dart 2, it turned out to be a more seriously breaking change than anticipated to make it an error to await e in the case where e has static type void.

Shouldn't we fix this now where null-safety is being introduced?

void foo() => null;

void main() async {
  await foo(); // Error, cannot await an expression of type `void`.
}

@leafpetersen, @lrhn, @munificent, WDYT?

@eernstg eernstg added feature Proposed language feature that solves one or more problems nnbd NNBD related issues labels Apr 17, 2020
@leafpetersen
Copy link
Member

It's fine by me. If @lrhn agrees with this change, we'd need a volunteer to spec it, write tests and file implementation issues.

@lrhn
Copy link
Member

lrhn commented Apr 18, 2020

I'm always fine with disallowing use of void!

@eernstg
Copy link
Member Author

eernstg commented Apr 20, 2020

Spec update in #933.

@eernstg
Copy link
Member Author

eernstg commented Apr 20, 2020

@eernstg eernstg added the Epic label Apr 21, 2020
@eernstg
Copy link
Member Author

eernstg commented Apr 21, 2020

Created issues for the analyzer and CFE implementation.

@leafpetersen
Copy link
Member

Tests and spec have landed, issues filed. I'm going to close this out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Proposed language feature that solves one or more problems nnbd NNBD related issues
Projects
None yet
Development

No branches or pull requests

3 participants