Problem
The parser rejects an explicit resource-management declaration used directly as a SwitchClause StatementListItem:
switch (0) {
case 0:
using value = { [Symbol.dispose]() {} };
break;
}The failure is ParseError.UnexpectedToken from parseStatementInner because parseSwitch does not establish the same using_allowed statement-list context as program/function/block parsing. The VM and tree-walker already implement CaseBlock lexical environments and disposal machinery; rejecting the syntax masks that runtime path.
Discovered while adding the forced-moving switch-environment witness for #834. The #834 test uses a lexical let to keep GC scope separate; this parser issue must not be worked around by rewriting source or broadening exclusions.
Acceptance
- Parse
usingdeclarations as direct StatementListItems in switch cases where the Explicit Resource Management grammar permits them. - Preserve early errors, TDZ/duplicate-binding checks across the whole CaseBlock, fall-through ordering, break/return/throw completion threading, and reverse-order disposal.
- Cover normal and abrupt completion in tree-walker and required-bytecode modes, including a disposal error and a moving-GC callback.
- Add the relevant nonzero test262 Explicit Resource Management / switch census and run focused OOM, TSan, and full unit gates.