Files
tsgo/testdata/baselines/reference/submodule/conformance/awaitUsingDeclarations.17.errors.txt
08cb84c68a Disallow [await] using statements under case/default clauses (#2742)
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: jakebailey <[email protected]>
2026-02-11 06:08:28 +00:00

43 lines
2.4 KiB
Plaintext

awaitUsingDeclarations.17.ts(3,9): error TS1548: 'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block.
awaitUsingDeclarations.17.ts(7,9): error TS1548: 'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block.
awaitUsingDeclarations.17.ts(11,9): error TS1548: 'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block.
awaitUsingDeclarations.17.ts(17,13): error TS1548: 'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block.
awaitUsingDeclarations.17.ts(21,13): error TS1548: 'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block.
==== awaitUsingDeclarations.17.ts (5 errors) ====
switch (Math.random()) {
case 0:
await using d20 = { async [Symbol.asyncDispose]() {} };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1548: 'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block.
break;
case 1:
await using d21 = { async [Symbol.asyncDispose]() {} };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1548: 'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block.
break;
default:
await using d22 = { async [Symbol.asyncDispose]() {} };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1548: 'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block.
}
if (true)
switch (0) {
case 0:
await using d23 = { async [Symbol.asyncDispose]() {} };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1548: 'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block.
break;
default:
await using d24 = { async [Symbol.asyncDispose]() {} };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1548: 'await using' declarations are not allowed in 'case' or 'default' clauses unless contained within a block.
}
export {};