|
1 | | -tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(3,10): error TS2815: 'arguments' cannot be referenced in property initializers. |
2 | | -tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(9,10): error TS2815: 'arguments' cannot be referenced in property initializers. |
3 | | -tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(15,15): error TS2815: 'arguments' cannot be referenced in property initializers. |
4 | | -tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(21,15): error TS2815: 'arguments' cannot be referenced in property initializers. |
| 1 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(3,10): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 2 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(9,10): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 3 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(15,15): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 4 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(21,15): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 5 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(33,16): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 6 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(40,7): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 7 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(42,16): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 8 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(57,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. |
| 9 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(60,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. |
| 10 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(66,6): error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later. |
| 11 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(75,7): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 12 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(77,9): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 13 | +tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts(96,26): error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
5 | 14 |
|
6 | 15 |
|
7 | | -==== tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts (4 errors) ==== |
| 16 | +==== tests/cases/compiler/argumentsUsedInClassFieldInitializerOrStaticInitializationBlock.ts (13 errors) ==== |
8 | 17 | function A() { |
9 | 18 | return class T { |
10 | 19 | a = arguments |
11 | 20 | ~~~~~~~~~ |
12 | | -!!! error TS2815: 'arguments' cannot be referenced in property initializers. |
| 21 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
13 | 22 | } |
14 | 23 | } |
15 | 24 |
|
16 | 25 | function A1() { |
17 | 26 | return new class T { |
18 | 27 | a = arguments |
19 | 28 | ~~~~~~~~~ |
20 | | -!!! error TS2815: 'arguments' cannot be referenced in property initializers. |
| 29 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
21 | 30 | } |
22 | 31 | } |
23 | 32 |
|
24 | 33 | function B() { |
25 | 34 | return class T { |
26 | 35 | a = { b: arguments } |
27 | 36 | ~~~~~~~~~ |
28 | | -!!! error TS2815: 'arguments' cannot be referenced in property initializers. |
| 37 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
29 | 38 | } |
30 | 39 | } |
31 | 40 |
|
32 | 41 | function B1() { |
33 | 42 | return new class T { |
34 | 43 | a = { b: arguments } |
35 | 44 | ~~~~~~~~~ |
36 | | -!!! error TS2815: 'arguments' cannot be referenced in property initializers. |
| 45 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
37 | 46 | } |
38 | 47 | } |
39 | 48 |
|
40 | 49 | function C() { |
41 | 50 | return class T { |
42 | 51 | a = function () { arguments } |
43 | 52 | } |
44 | | - } |
| 53 | + } |
| 54 | + |
| 55 | + function D() { |
| 56 | + return class T { |
| 57 | + a = () => arguments // should error |
| 58 | + ~~~~~~~~~ |
| 59 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | + function D1() { |
| 64 | + return class T { |
| 65 | + a = () => { |
| 66 | + arguments; // should error |
| 67 | + ~~~~~~~~~ |
| 68 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 69 | + const b = () => { |
| 70 | + return arguments; // should error |
| 71 | + ~~~~~~~~~ |
| 72 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 73 | + } |
| 74 | + |
| 75 | + function f() { |
| 76 | + return arguments; // ok |
| 77 | + } |
| 78 | + } |
| 79 | + } |
| 80 | + } |
| 81 | + |
| 82 | + function D2() { |
| 83 | + return class { |
| 84 | + constructor() { |
| 85 | + arguments; // ok |
| 86 | + } |
| 87 | + get foo() { |
| 88 | + ~~~ |
| 89 | +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. |
| 90 | + return arguments; // ok |
| 91 | + } |
| 92 | + set foo(foo: any) { |
| 93 | + ~~~ |
| 94 | +!!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. |
| 95 | + arguments; // ok |
| 96 | + } |
| 97 | + bar() { |
| 98 | + arguments; // ok |
| 99 | + } |
| 100 | + [Symbol.iterator]() { |
| 101 | + ~~~~~~ |
| 102 | +!!! error TS2585: 'Symbol' only refers to a type, but is being used as a value here. Do you need to change your target library? Try changing the 'lib' compiler option to es2015 or later. |
| 103 | + arguments; // ok |
| 104 | + } |
| 105 | + } |
| 106 | + } |
| 107 | + |
| 108 | + function D3() { |
| 109 | + return class T { |
| 110 | + static { |
| 111 | + arguments; // should error |
| 112 | + ~~~~~~~~~ |
| 113 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 114 | + while(1) { |
| 115 | + arguments // should error |
| 116 | + ~~~~~~~~~ |
| 117 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 118 | + } |
| 119 | + } |
| 120 | + } |
| 121 | + } |
| 122 | + |
| 123 | + function D4() { |
| 124 | + return class T { |
| 125 | + static { |
| 126 | + function f() { |
| 127 | + arguments; // ok |
| 128 | + } |
| 129 | + } |
| 130 | + } |
| 131 | + } |
| 132 | + |
| 133 | + |
| 134 | + function D5() { |
| 135 | + return class T { |
| 136 | + a = (() => { return arguments; })() // should error |
| 137 | + ~~~~~~~~~ |
| 138 | +!!! error TS2815: 'arguments' cannot be referenced in property initializers or class static initialization block. |
| 139 | + } |
| 140 | + } |
| 141 | + |
0 commit comments