Should reject using / await using in a switch case / default clause
Opened this issue ยท 1 comments
sapphi-red commented
๐ Search Terms
explicit resource management, using, await using, switch, case clause, default clause
๐ Version & Regression Information
- This changed between versions ______ and _______
- This changed in commit or PR _______
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about _________
- I was unable to test this on prior versions because _______
โฏ Playground Link
๐ป Code
switch (Math.random()) {
case 0:
using d20 = { [Symbol.dispose]() {} };
break;
case 1:
await using d21 = { [Symbol.dispose]() {} };
break;
}
export {}๐ Actual behavior
No error happens.
๐ Expected behavior
The error is reported that using / await using cannot be used here.
Additional information about the issue
The spec was updated to disallow this (rbuckton/ecma262#14).
Related PRs in other projects:
Some tests needs to be updated. For example:
RyanCavanaugh commented
๐ค This is an automated response. I looked for things that might help (duplicates, FAQ entries, etc) but didn't find anything. A human will take a look!