fix(parser): reject using/await using in switch case/default clauses#62732
Closed
PaulyBearCoding wants to merge 1 commit intomicrosoft:mainfrom
Closed
fix(parser): reject using/await using in switch case/default clauses#62732PaulyBearCoding wants to merge 1 commit intomicrosoft:mainfrom
PaulyBearCoding wants to merge 1 commit intomicrosoft:mainfrom
Conversation
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
Member
|
We already have #62709 open, I don't think we need more than one of these |
Author
|
Apologies for the duplicate! I completely missed #62709 in my search. Closing this in favor of the existing PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).