diff --git a/tests/baselines/reference/classStaticBlock22.errors.txt b/tests/baselines/reference/classStaticBlock22.errors.txt index 8a12b3ffe84cd..cb89b33e3bc3b 100644 --- a/tests/baselines/reference/classStaticBlock22.errors.txt +++ b/tests/baselines/reference/classStaticBlock22.errors.txt @@ -1,84 +1,59 @@ -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(16,5): error TS18037: Await expression cannot be used inside a class static block. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(16,10): error TS1109: Expression expected. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(19,5): error TS18037: Await expression cannot be used inside a class static block. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(28,14): error TS1005: ':' expected. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(31,9): error TS18037: Await expression cannot be used inside a class static block. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(31,14): error TS1109: Expression expected. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(37,10): error TS18037: Await expression cannot be used inside a class static block. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(37,15): error TS1109: Expression expected. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(53,5): error TS18037: Await expression cannot be used inside a class static block. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(53,10): error TS1109: Expression expected. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(54,15): error TS1003: Identifier expected. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(54,15): error TS18037: Await expression cannot be used inside a class static block. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(54,20): error TS1109: Expression expected. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(87,17): error TS18037: Await expression cannot be used inside a class static block. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(87,22): error TS1109: Expression expected. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(87,24): error TS1005: ';' expected. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(88,17): error TS18037: Await expression cannot be used inside a class static block. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(88,23): error TS1109: Expression expected. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(4,9): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(7,11): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(13,9): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(16,14): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(19,11): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(29,15): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(32,12): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. -==== tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts (18 errors) ==== +==== tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts (7 errors) ==== let await: "any"; class C { static { let await: any; // illegal, cannot declare a new binding for await + ~~~~~ +!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. } static { let { await } = {} as any; // illegal, cannot declare a new binding for await + ~~~~~ +!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. } static { let { await: other } = {} as any; // legal } static { let await; // illegal, cannot declare a new binding for await + ~~~~~ +!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. } static { - await; // illegal - ~~~~~ -!!! error TS18037: Await expression cannot be used inside a class static block. - ~ -!!! error TS1109: Expression expected. - } - static { - await(1); // illegal - ~~~~~~~~ -!!! error TS18037: Await expression cannot be used inside a class static block. - } - static { - function await() {}; // illegal - } - static { - class await {}; // illegal - } - static { - ({ await }); // illegal short-hand property reference - ~ -!!! error TS1005: ':' expected. + function await() { }; // illegal + ~~~~~ +!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. } static { - ({ [await]: 1 }); // illegal - ~~~~~ -!!! error TS18037: Await expression cannot be used inside a class static block. - ~ -!!! error TS1109: Expression expected. + class await { }; // illegal + ~~~~~ +!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. } + static { class D { - await = 1; // legal - x = await; // legal (initializers have an implicit function boundary) - [await] = 1; // illegal (computed property names are evaluated outside of a class body - ~~~~~ -!!! error TS18037: Await expression cannot be used inside a class static block. - ~ -!!! error TS1109: Expression expected. - }; + await = 1; // legal + x = await; // legal (initializers have an implicit function boundary) + }; } static { - (function await() {}); // legal, 'await' in function expression name not bound inside of static block + (function await() { }); // legal, 'await' in function expression name not bound inside of static block + ~~~~~ +!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. } static { - (class await {}); // legal, 'await' in class expression name not bound inside of static block + (class await { }); // legal, 'await' in class expression name not bound inside of static block + ~~~~~ +!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. } static { (function () { return await; }); // legal, 'await' is inside of a new function boundary @@ -86,29 +61,16 @@ tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(88,23): e static { (() => await); // legal, 'await' is inside of a new function boundary } - static { - await: // illegal, 'await' cannot be used as a label - ~~~~~ -!!! error TS18037: Await expression cannot be used inside a class static block. - ~ -!!! error TS1109: Expression expected. - break await; // illegal, 'await' cannot be used as a label - ~~~~~ -!!! error TS1003: Identifier expected. - ~~~~~ -!!! error TS18037: Await expression cannot be used inside a class static block. - ~ -!!! error TS1109: Expression expected. - } + static { class E { - constructor () { await; } - method () { await; } - get accessor () { + constructor() { await; } + method() { await; } + get accessor() { await; return 1; } - set accessor (v: any) { + set accessor(v: any) { await; } propLambda = () => { await; } @@ -117,31 +79,16 @@ tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts(88,23): e } static { class S { - static method () { await; } - static get accessor () { + static method() { await; } + static get accessor() { await; return 1; } - static set accessor (v: any) { + static set accessor(v: any) { await; } static propLambda = () => { await; } static propFunc = function () { await; } } } - static { - function f (await) {} - const ff = (await) => {} - ~~~~~ -!!! error TS18037: Await expression cannot be used inside a class static block. - ~ -!!! error TS1109: Expression expected. - ~~ -!!! error TS1005: ';' expected. - const fff = await => {} - ~~~~~ -!!! error TS18037: Await expression cannot be used inside a class static block. - ~~ -!!! error TS1109: Expression expected. - } } \ No newline at end of file diff --git a/tests/baselines/reference/classStaticBlock22.js b/tests/baselines/reference/classStaticBlock22.js index 1757b74fa225f..bed746875acdf 100644 --- a/tests/baselines/reference/classStaticBlock22.js +++ b/tests/baselines/reference/classStaticBlock22.js @@ -14,35 +14,23 @@ class C { let await; // illegal, cannot declare a new binding for await } static { - await; // illegal + function await() { }; // illegal } static { - await(1); // illegal - } - static { - function await() {}; // illegal - } - static { - class await {}; // illegal - } - static { - ({ await }); // illegal short-hand property reference - } - static { - ({ [await]: 1 }); // illegal + class await { }; // illegal } + static { class D { - await = 1; // legal - x = await; // legal (initializers have an implicit function boundary) - [await] = 1; // illegal (computed property names are evaluated outside of a class body - }; + await = 1; // legal + x = await; // legal (initializers have an implicit function boundary) + }; } static { - (function await() {}); // legal, 'await' in function expression name not bound inside of static block + (function await() { }); // legal, 'await' in function expression name not bound inside of static block } static { - (class await {}); // legal, 'await' in class expression name not bound inside of static block + (class await { }); // legal, 'await' in class expression name not bound inside of static block } static { (function () { return await; }); // legal, 'await' is inside of a new function boundary @@ -50,19 +38,16 @@ class C { static { (() => await); // legal, 'await' is inside of a new function boundary } - static { - await: // illegal, 'await' cannot be used as a label - break await; // illegal, 'await' cannot be used as a label - } + static { class E { - constructor () { await; } - method () { await; } - get accessor () { + constructor() { await; } + method() { await; } + get accessor() { await; return 1; } - set accessor (v: any) { + set accessor(v: any) { await; } propLambda = () => { await; } @@ -71,23 +56,18 @@ class C { } static { class S { - static method () { await; } - static get accessor () { + static method() { await; } + static get accessor() { await; return 1; } - static set accessor (v: any) { + static set accessor(v: any) { await; } static propLambda = () => { await; } static propFunc = function () { await; } } } - static { - function f (await) {} - const ff = (await) => {} - const fff = await => {} - } } //// [classStaticBlock22.js] @@ -105,12 +85,6 @@ class C { static { let await; // illegal, cannot declare a new binding for await } - static { - await ; // illegal - } - static { - await (1); // illegal - } static { function await() { } ; // illegal @@ -120,17 +94,10 @@ class C { } ; // illegal } - static { - ({ await: }); // illegal short-hand property reference - } - static { - ({ [await ]: 1 }); // illegal - } static { class D { await = 1; // legal x = await; // legal (initializers have an implicit function boundary) - [await ] = 1; // illegal (computed property names are evaluated outside of a class body } ; } @@ -147,11 +114,6 @@ class C { static { (() => await); // legal, 'await' is inside of a new function boundary } - static { - await ; - break ; - await ; // illegal, 'await' cannot be used as a label - } static { class E { constructor() { await; } @@ -181,11 +143,4 @@ class C { static propFunc = function () { await; }; } } - static { - function f(await) { } - const ff = (await ); - { } - const fff = await ; - { } - } } diff --git a/tests/baselines/reference/classStaticBlock22.symbols b/tests/baselines/reference/classStaticBlock22.symbols index 56735f54b666c..9f78f245322f3 100644 --- a/tests/baselines/reference/classStaticBlock22.symbols +++ b/tests/baselines/reference/classStaticBlock22.symbols @@ -22,50 +22,34 @@ class C { >await : Symbol(await, Decl(classStaticBlock22.ts, 12, 7)) } static { - await; // illegal + function await() { }; // illegal +>await : Symbol(await, Decl(classStaticBlock22.ts, 14, 10)) } static { - await(1); // illegal - } - static { - function await() {}; // illegal ->await : Symbol(await, Decl(classStaticBlock22.ts, 20, 10)) - } - static { - class await {}; // illegal ->await : Symbol(await, Decl(classStaticBlock22.ts, 23, 10)) - } - static { - ({ await }); // illegal short-hand property reference ->await : Symbol(await, Decl(classStaticBlock22.ts, 27, 6)) - } - static { - ({ [await]: 1 }); // illegal ->[await] : Symbol([await], Decl(classStaticBlock22.ts, 30, 6)) + class await { }; // illegal +>await : Symbol(await, Decl(classStaticBlock22.ts, 17, 10)) } + static { class D { ->D : Symbol(D, Decl(classStaticBlock22.ts, 32, 10)) +>D : Symbol(D, Decl(classStaticBlock22.ts, 21, 10)) - await = 1; // legal ->await : Symbol(D.await, Decl(classStaticBlock22.ts, 33, 13)) + await = 1; // legal +>await : Symbol(D.await, Decl(classStaticBlock22.ts, 22, 13)) - x = await; // legal (initializers have an implicit function boundary) ->x : Symbol(D.x, Decl(classStaticBlock22.ts, 34, 18)) + x = await; // legal (initializers have an implicit function boundary) +>x : Symbol(D.x, Decl(classStaticBlock22.ts, 23, 16)) >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) - [await] = 1; // illegal (computed property names are evaluated outside of a class body ->[await] : Symbol(D[await], Decl(classStaticBlock22.ts, 35, 18)) - - }; + }; } static { - (function await() {}); // legal, 'await' in function expression name not bound inside of static block ->await : Symbol(await, Decl(classStaticBlock22.ts, 40, 5)) + (function await() { }); // legal, 'await' in function expression name not bound inside of static block +>await : Symbol(await, Decl(classStaticBlock22.ts, 28, 5)) } static { - (class await {}); // legal, 'await' in class expression name not bound inside of static block ->await : Symbol(await, Decl(classStaticBlock22.ts, 43, 5)) + (class await { }); // legal, 'await' in class expression name not bound inside of static block +>await : Symbol(await, Decl(classStaticBlock22.ts, 31, 5)) } static { (function () { return await; }); // legal, 'await' is inside of a new function boundary @@ -75,86 +59,72 @@ class C { (() => await); // legal, 'await' is inside of a new function boundary >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) } - static { - await: // illegal, 'await' cannot be used as a label - break await; // illegal, 'await' cannot be used as a label - } + static { class E { ->E : Symbol(E, Decl(classStaticBlock22.ts, 55, 10)) +>E : Symbol(E, Decl(classStaticBlock22.ts, 40, 10)) - constructor () { await; } + constructor() { await; } >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) - method () { await; } ->method : Symbol(E.method, Decl(classStaticBlock22.ts, 57, 31)) + method() { await; } +>method : Symbol(E.method, Decl(classStaticBlock22.ts, 42, 30)) >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) - get accessor () { ->accessor : Symbol(E.accessor, Decl(classStaticBlock22.ts, 58, 26), Decl(classStaticBlock22.ts, 62, 7)) + get accessor() { +>accessor : Symbol(E.accessor, Decl(classStaticBlock22.ts, 43, 25), Decl(classStaticBlock22.ts, 47, 7)) await; >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) return 1; } - set accessor (v: any) { ->accessor : Symbol(E.accessor, Decl(classStaticBlock22.ts, 58, 26), Decl(classStaticBlock22.ts, 62, 7)) ->v : Symbol(v, Decl(classStaticBlock22.ts, 63, 20)) + set accessor(v: any) { +>accessor : Symbol(E.accessor, Decl(classStaticBlock22.ts, 43, 25), Decl(classStaticBlock22.ts, 47, 7)) +>v : Symbol(v, Decl(classStaticBlock22.ts, 48, 19)) await; >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) } propLambda = () => { await; } ->propLambda : Symbol(E.propLambda, Decl(classStaticBlock22.ts, 65, 7)) +>propLambda : Symbol(E.propLambda, Decl(classStaticBlock22.ts, 50, 7)) >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) propFunc = function () { await; } ->propFunc : Symbol(E.propFunc, Decl(classStaticBlock22.ts, 66, 35)) +>propFunc : Symbol(E.propFunc, Decl(classStaticBlock22.ts, 51, 35)) >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) } } static { class S { ->S : Symbol(S, Decl(classStaticBlock22.ts, 70, 10)) +>S : Symbol(S, Decl(classStaticBlock22.ts, 55, 10)) - static method () { await; } ->method : Symbol(S.method, Decl(classStaticBlock22.ts, 71, 13)) + static method() { await; } +>method : Symbol(S.method, Decl(classStaticBlock22.ts, 56, 13)) >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) - static get accessor () { ->accessor : Symbol(S.accessor, Decl(classStaticBlock22.ts, 72, 33), Decl(classStaticBlock22.ts, 76, 7)) + static get accessor() { +>accessor : Symbol(S.accessor, Decl(classStaticBlock22.ts, 57, 32), Decl(classStaticBlock22.ts, 61, 7)) await; >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) return 1; } - static set accessor (v: any) { ->accessor : Symbol(S.accessor, Decl(classStaticBlock22.ts, 72, 33), Decl(classStaticBlock22.ts, 76, 7)) ->v : Symbol(v, Decl(classStaticBlock22.ts, 77, 27)) + static set accessor(v: any) { +>accessor : Symbol(S.accessor, Decl(classStaticBlock22.ts, 57, 32), Decl(classStaticBlock22.ts, 61, 7)) +>v : Symbol(v, Decl(classStaticBlock22.ts, 62, 26)) await; >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) } static propLambda = () => { await; } ->propLambda : Symbol(S.propLambda, Decl(classStaticBlock22.ts, 79, 7)) +>propLambda : Symbol(S.propLambda, Decl(classStaticBlock22.ts, 64, 7)) >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) static propFunc = function () { await; } ->propFunc : Symbol(S.propFunc, Decl(classStaticBlock22.ts, 80, 42)) +>propFunc : Symbol(S.propFunc, Decl(classStaticBlock22.ts, 65, 42)) >await : Symbol(await, Decl(classStaticBlock22.ts, 0, 3)) } } - static { - function f (await) {} ->f : Symbol(f, Decl(classStaticBlock22.ts, 84, 10)) ->await : Symbol(await, Decl(classStaticBlock22.ts, 85, 16)) - - const ff = (await) => {} ->ff : Symbol(ff, Decl(classStaticBlock22.ts, 86, 9)) - - const fff = await => {} ->fff : Symbol(fff, Decl(classStaticBlock22.ts, 87, 9)) - } } diff --git a/tests/baselines/reference/classStaticBlock22.types b/tests/baselines/reference/classStaticBlock22.types index e581d5b18851d..8334f1b584217 100644 --- a/tests/baselines/reference/classStaticBlock22.types +++ b/tests/baselines/reference/classStaticBlock22.types @@ -27,70 +27,38 @@ class C { >await : any } static { - await; // illegal ->await : any -> : any - } - static { - await(1); // illegal ->await(1) : 1 ->(1) : 1 ->1 : 1 - } - static { - function await() {}; // illegal + function await() { }; // illegal >await : () => void } static { - class await {}; // illegal + class await { }; // illegal >await : await } - static { - ({ await }); // illegal short-hand property reference ->({ await }) : { await: any; } ->{ await } : { await: any; } ->await : any -> : any - } - static { - ({ [await]: 1 }); // illegal ->({ [await]: 1 }) : { [x: number]: number; } ->{ [await]: 1 } : { [x: number]: number; } ->[await] : number ->await : any -> : any ->1 : 1 - } + static { class D { >D : D - await = 1; // legal + await = 1; // legal >await : number >1 : 1 - x = await; // legal (initializers have an implicit function boundary) + x = await; // legal (initializers have an implicit function boundary) >x : "any" >await : "any" - [await] = 1; // illegal (computed property names are evaluated outside of a class body ->[await] : number ->await : any -> : any ->1 : 1 - - }; + }; } static { - (function await() {}); // legal, 'await' in function expression name not bound inside of static block ->(function await() {}) : () => void ->function await() {} : () => void + (function await() { }); // legal, 'await' in function expression name not bound inside of static block +>(function await() { }) : () => void +>function await() { } : () => void >await : () => void } static { - (class await {}); // legal, 'await' in class expression name not bound inside of static block ->(class await {}) : typeof await ->class await {} : typeof await + (class await { }); // legal, 'await' in class expression name not bound inside of static block +>(class await { }) : typeof await +>class await { } : typeof await >await : typeof await } static { @@ -105,28 +73,19 @@ class C { >() => await : () => "any" >await : "any" } - static { - await: // illegal, 'await' cannot be used as a label ->await : any -> : any - break await; // illegal, 'await' cannot be used as a label -> : any ->await : any -> : any - } static { class E { >E : E - constructor () { await; } + constructor() { await; } >await : "any" - method () { await; } + method() { await; } >method : () => void >await : "any" - get accessor () { + get accessor() { >accessor : any await; @@ -135,7 +94,7 @@ class C { return 1; >1 : 1 } - set accessor (v: any) { + set accessor(v: any) { >accessor : any >v : any @@ -157,11 +116,11 @@ class C { class S { >S : S - static method () { await; } + static method() { await; } >method : () => void >await : "any" - static get accessor () { + static get accessor() { >accessor : any await; @@ -170,7 +129,7 @@ class C { return 1; >1 : 1 } - static set accessor (v: any) { + static set accessor(v: any) { >accessor : any >v : any @@ -188,20 +147,4 @@ class C { >await : "any" } } - static { - function f (await) {} ->f : (await: any) => void ->await : any - - const ff = (await) => {} ->ff : any ->(await) : any ->await : any -> : any - - const fff = await => {} ->fff : any ->await : any -> : any - } } diff --git a/tests/baselines/reference/classStaticBlock26.errors.txt b/tests/baselines/reference/classStaticBlock26.errors.txt index bc5938561ce2a..3c5eb52fb8f34 100644 --- a/tests/baselines/reference/classStaticBlock26.errors.txt +++ b/tests/baselines/reference/classStaticBlock26.errors.txt @@ -1,24 +1,86 @@ -tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(3,13): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(6,13): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. -tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(9,15): error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(3,9): error TS18037: Await expression cannot be used inside a class static block. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(3,14): error TS1109: Expression expected. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(6,9): error TS18037: Await expression cannot be used inside a class static block. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(9,13): error TS18037: Await expression cannot be used inside a class static block. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(9,18): error TS1109: Expression expected. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(13,14): error TS18037: Await expression cannot be used inside a class static block. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(13,19): error TS1109: Expression expected. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(17,18): error TS1005: ':' expected. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(20,9): error TS18037: Await expression cannot be used inside a class static block. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(20,14): error TS1109: Expression expected. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(21,15): error TS1003: Identifier expected. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(21,15): error TS18037: Await expression cannot be used inside a class static block. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(21,20): error TS1109: Expression expected. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(25,21): error TS18037: Await expression cannot be used inside a class static block. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(25,26): error TS1109: Expression expected. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(25,28): error TS1005: ';' expected. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(26,21): error TS18037: Await expression cannot be used inside a class static block. +tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts(26,27): error TS1109: Expression expected. -==== tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts (3 errors) ==== +==== tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts (18 errors) ==== class C { static { - let await = 1; - ~~~~~ -!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. + await; // illegal + ~~~~~ +!!! error TS18037: Await expression cannot be used inside a class static block. + ~ +!!! error TS1109: Expression expected. + } + static { + await (1); // illegal + ~~~~~~~~~ +!!! error TS18037: Await expression cannot be used inside a class static block. } static { - var await = 1; + ({ [await]: 1 }); // illegal ~~~~~ -!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. +!!! error TS18037: Await expression cannot be used inside a class static block. + ~ +!!! error TS1109: Expression expected. + } + static { + class D { + [await] = 1; // illegal (computed property names are evaluated outside of a class body + ~~~~~ +!!! error TS18037: Await expression cannot be used inside a class static block. + ~ +!!! error TS1109: Expression expected. + }; } static { - const await = 1; + ({ await }); // illegal short-hand property reference + ~ +!!! error TS1005: ':' expected. + } + static { + await: // illegal, 'await' cannot be used as a label + ~~~~~ +!!! error TS18037: Await expression cannot be used inside a class static block. + ~ +!!! error TS1109: Expression expected. + break await; // illegal, 'await' cannot be used as a label + ~~~~~ +!!! error TS1003: Identifier expected. ~~~~~ -!!! error TS1359: Identifier expected. 'await' is a reserved word that cannot be used here. +!!! error TS18037: Await expression cannot be used inside a class static block. + ~ +!!! error TS1109: Expression expected. + } + static { + function f(await) { } + const ff = (await) => { } + ~~~~~ +!!! error TS18037: Await expression cannot be used inside a class static block. + ~ +!!! error TS1109: Expression expected. + ~~ +!!! error TS1005: ';' expected. + const fff = await => { } + ~~~~~ +!!! error TS18037: Await expression cannot be used inside a class static block. + ~~ +!!! error TS1109: Expression expected. } } \ No newline at end of file diff --git a/tests/baselines/reference/classStaticBlock26.js b/tests/baselines/reference/classStaticBlock26.js index 7b7ff83dc23c5..ababa6abf24ac 100644 --- a/tests/baselines/reference/classStaticBlock26.js +++ b/tests/baselines/reference/classStaticBlock26.js @@ -1,13 +1,30 @@ //// [classStaticBlock26.ts] class C { static { - let await = 1; + await; // illegal } static { - var await = 1; + await (1); // illegal } static { - const await = 1; + ({ [await]: 1 }); // illegal + } + static { + class D { + [await] = 1; // illegal (computed property names are evaluated outside of a class body + }; + } + static { + ({ await }); // illegal short-hand property reference + } + static { + await: // illegal, 'await' cannot be used as a label + break await; // illegal, 'await' cannot be used as a label + } + static { + function f(await) { } + const ff = (await) => { } + const fff = await => { } } } @@ -15,12 +32,33 @@ class C { //// [classStaticBlock26.js] class C { static { - let await = 1; + await ; // illegal + } + static { + await (1); // illegal + } + static { + ({ [await ]: 1 }); // illegal + } + static { + class D { + [await ] = 1; // illegal (computed property names are evaluated outside of a class body + } + ; + } + static { + ({ await: }); // illegal short-hand property reference } static { - var await = 1; + await ; + break ; + await ; // illegal, 'await' cannot be used as a label } static { - const await = 1; + function f(await) { } + const ff = (await ); + { } + const fff = await ; + { } } } diff --git a/tests/baselines/reference/classStaticBlock26.symbols b/tests/baselines/reference/classStaticBlock26.symbols index c104550329ce6..2d3b2717ba213 100644 --- a/tests/baselines/reference/classStaticBlock26.symbols +++ b/tests/baselines/reference/classStaticBlock26.symbols @@ -3,16 +3,42 @@ class C { >C : Symbol(C, Decl(classStaticBlock26.ts, 0, 0)) static { - let await = 1; ->await : Symbol(await, Decl(classStaticBlock26.ts, 2, 11)) + await; // illegal } static { - var await = 1; ->await : Symbol(await, Decl(classStaticBlock26.ts, 5, 11)) + await (1); // illegal } static { - const await = 1; ->await : Symbol(await, Decl(classStaticBlock26.ts, 8, 13)) + ({ [await]: 1 }); // illegal +>[await] : Symbol([await], Decl(classStaticBlock26.ts, 8, 10)) + } + static { + class D { +>D : Symbol(D, Decl(classStaticBlock26.ts, 10, 12)) + + [await] = 1; // illegal (computed property names are evaluated outside of a class body +>[await] : Symbol(D[await], Decl(classStaticBlock26.ts, 11, 17)) + + }; + } + static { + ({ await }); // illegal short-hand property reference +>await : Symbol(await, Decl(classStaticBlock26.ts, 16, 10)) + } + static { + await: // illegal, 'await' cannot be used as a label + break await; // illegal, 'await' cannot be used as a label + } + static { + function f(await) { } +>f : Symbol(f, Decl(classStaticBlock26.ts, 22, 12)) +>await : Symbol(await, Decl(classStaticBlock26.ts, 23, 19)) + + const ff = (await) => { } +>ff : Symbol(ff, Decl(classStaticBlock26.ts, 24, 13)) + + const fff = await => { } +>fff : Symbol(fff, Decl(classStaticBlock26.ts, 25, 13)) } } diff --git a/tests/baselines/reference/classStaticBlock26.types b/tests/baselines/reference/classStaticBlock26.types index 148518a06ed89..0922330a47533 100644 --- a/tests/baselines/reference/classStaticBlock26.types +++ b/tests/baselines/reference/classStaticBlock26.types @@ -3,19 +3,69 @@ class C { >C : C static { - let await = 1; ->await : number + await; // illegal +>await : any +> : any + } + static { + await (1); // illegal +>await (1) : 1 +>(1) : 1 >1 : 1 } static { - var await = 1; ->await : number + ({ [await]: 1 }); // illegal +>({ [await]: 1 }) : { [x: number]: number; } +>{ [await]: 1 } : { [x: number]: number; } +>[await] : number +>await : any +> : any >1 : 1 } static { - const await = 1; ->await : 1 + class D { +>D : D + + [await] = 1; // illegal (computed property names are evaluated outside of a class body +>[await] : number +>await : any +> : any >1 : 1 + + }; + } + static { + ({ await }); // illegal short-hand property reference +>({ await }) : { await: any; } +>{ await } : { await: any; } +>await : any +> : any + } + static { + await: // illegal, 'await' cannot be used as a label +>await : any +> : any + + break await; // illegal, 'await' cannot be used as a label +> : any +>await : any +> : any + } + static { + function f(await) { } +>f : (await: any) => void +>await : any + + const ff = (await) => { } +>ff : any +>(await) : any +>await : any +> : any + + const fff = await => { } +>fff : any +>await : any +> : any } } diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts index e1d605290a37e..8d3be9861aa71 100644 --- a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts +++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock22.ts @@ -15,35 +15,23 @@ class C { let await; // illegal, cannot declare a new binding for await } static { - await; // illegal + function await() { }; // illegal } static { - await(1); // illegal - } - static { - function await() {}; // illegal - } - static { - class await {}; // illegal - } - static { - ({ await }); // illegal short-hand property reference - } - static { - ({ [await]: 1 }); // illegal + class await { }; // illegal } + static { class D { - await = 1; // legal - x = await; // legal (initializers have an implicit function boundary) - [await] = 1; // illegal (computed property names are evaluated outside of a class body - }; + await = 1; // legal + x = await; // legal (initializers have an implicit function boundary) + }; } static { - (function await() {}); // legal, 'await' in function expression name not bound inside of static block + (function await() { }); // legal, 'await' in function expression name not bound inside of static block } static { - (class await {}); // legal, 'await' in class expression name not bound inside of static block + (class await { }); // legal, 'await' in class expression name not bound inside of static block } static { (function () { return await; }); // legal, 'await' is inside of a new function boundary @@ -51,19 +39,16 @@ class C { static { (() => await); // legal, 'await' is inside of a new function boundary } - static { - await: // illegal, 'await' cannot be used as a label - break await; // illegal, 'await' cannot be used as a label - } + static { class E { - constructor () { await; } - method () { await; } - get accessor () { + constructor() { await; } + method() { await; } + get accessor() { await; return 1; } - set accessor (v: any) { + set accessor(v: any) { await; } propLambda = () => { await; } @@ -72,21 +57,16 @@ class C { } static { class S { - static method () { await; } - static get accessor () { + static method() { await; } + static get accessor() { await; return 1; } - static set accessor (v: any) { + static set accessor(v: any) { await; } static propLambda = () => { await; } static propFunc = function () { await; } } } - static { - function f (await) {} - const ff = (await) => {} - const fff = await => {} - } } \ No newline at end of file diff --git a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts index 0524027744119..1081729acdb2d 100644 --- a/tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts +++ b/tests/cases/conformance/classes/classStaticBlock/classStaticBlock26.ts @@ -2,12 +2,29 @@ class C { static { - let await = 1; + await; // illegal } static { - var await = 1; + await (1); // illegal } static { - const await = 1; + ({ [await]: 1 }); // illegal + } + static { + class D { + [await] = 1; // illegal (computed property names are evaluated outside of a class body + }; + } + static { + ({ await }); // illegal short-hand property reference + } + static { + await: // illegal, 'await' cannot be used as a label + break await; // illegal, 'await' cannot be used as a label + } + static { + function f(await) { } + const ff = (await) => { } + const fff = await => { } } }