Skip to content

Conversation

@PaulyBearCoding
Copy link

Fixes #62708

The parser allowed using/await using declarations directly in switch case and
default clauses, but the spec was updated to disallow this. Added check during
parsing that uses context bitfields to distinguish direct nesting (error) from
block-wrapped declarations (valid).

Fixes microsoft#62708

The ECMAScript spec was updated to disallow using and await using
declarations directly in switch case/default clauses. This makes
resource declaration count statically knowable.

Added parser validation that checks parsing context using bitfields
to distinguish direct nesting (error) from nested blocks (valid).
Block-wrapped declarations remain allowed.

Test coverage:
- usingDeclarations.1.ts: 3 errors caught
- awaitUsingDeclarations.1.ts: 3 errors caught
- New comprehensive tests: error cases + edge cases
- Full suite: 2087 tests passing
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Nov 7, 2025
@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Nov 7, 2025
@jakebailey
Copy link
Member

We already have #62709 open, I don't think we need more than one of these

@PaulyBearCoding
Copy link
Author

Apologies for the duplicate! I completely missed #62709 in my search. Closing this in favor of the existing PR.

@github-project-automation github-project-automation bot moved this from Not started to Done in PR Backlog Nov 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Should reject using / await using in a switch case / default clause

3 participants