Skip to content

Add runtime type check for 'await' in DDC #50602

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
alexmarkov opened this issue Dec 1, 2022 · 5 comments
Closed

Add runtime type check for 'await' in DDC #50602

alexmarkov opened this issue Dec 1, 2022 · 5 comments
Assignees
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. P2 A bug or feature request we're likely to work on web-dev-compiler

Comments

@alexmarkov
Copy link
Contributor

This is a DDC part of #49396.

According to the spec, await e should check runtime type of e to be a Future<flatten(S)> where S is a static type of e before waiting for e (otherwise it should wait for Future.value(e)). See #49396 for details.

Kernel AST contains the type to check in AwaitExpression.runtimeCheckType.

@sigmundch @nshahan

@alexmarkov alexmarkov added web-dev-compiler area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. labels Dec 1, 2022
@nshahan
Copy link
Contributor

nshahan commented Dec 2, 2022

Waiting for test cases to be finalized and landed https://dart-review.git.corp.google.com/c/sdk/+/267422.

@nshahan nshahan added the P2 A bug or feature request we're likely to work on label Dec 3, 2022
@nshahan
Copy link
Contributor

nshahan commented Dec 8, 2022

Tests landed but contain unexpected compile time errors. It sounds like these should not be errors. Waiting on CFE work to accept the code in the test.

@alexmarkov
Copy link
Contributor Author

You can also use language/async/await_type_check_test which was landed in 66f1dee until those compile-time errors are sorted out.

@eernstg
Copy link
Member

eernstg commented Dec 9, 2022

@alexmarkov and @nshahan, the definition of flatten turned out to be too aggressive (causing gratuitous loss of type information), so it was adjusted, cf. #49396 (comment). Sorry about the inconvenience this may cause!

@nshahan
Copy link
Contributor

nshahan commented Dec 12, 2022

@alexmarkov @eernstg Thanks for the updates!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web-js Issues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop. P2 A bug or feature request we're likely to work on web-dev-compiler
Projects
None yet
Development

No branches or pull requests

3 participants