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

Lint ES AO invocations for correct usage of !/? #2238

Open
syg opened this issue Mar 1, 2022 · 1 comment
Open

Lint ES AO invocations for correct usage of !/? #2238

syg opened this issue Mar 1, 2022 · 1 comment
Labels
enhancement project-consistency-checking Includes checking algorithm arguments, variable types, field access, etc.

Comments

@syg
Copy link

syg commented Mar 1, 2022

Once tc39/ecma262#2675 lands, other specs will have easy access to type signatures of ECMAScript abstract operations. It would be useful to build in a linting phase in bikeshed that does extra checking of the invocations of AOs that return completions. Such invocations must be annotated in one of three ways:

  1. Prefixed with !, meaning asserting that only normal completions are returned and unwrapping the returned value within the Completion Record.
  2. Prefixed with ?, meaning doing early returns on abrupt completions and unwrapping the returned value within the Completion Record on normal completions.
  3. Wrapped with Completion(...), meaning manual processing is done in a later step.

/cc other TC39 editors @bakkot and @michaelficarra

@syg
Copy link
Author

syg commented Mar 1, 2022

The converse is also helpful to lint: AOs that do not return completions must not be annotated with any of the three options above.

@jyasskin jyasskin added this to the Add type checking milestone Dec 14, 2022
@jyasskin jyasskin added the project-consistency-checking Includes checking algorithm arguments, variable types, field access, etc. label Jan 31, 2023
@jyasskin jyasskin removed this from the Add type checking milestone Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement project-consistency-checking Includes checking algorithm arguments, variable types, field access, etc.
Projects
None yet
Development

No branches or pull requests

2 participants