TypeScript/tests/baselines/reference/constDeclarations-access4.errors.txt

102 lines
4.7 KiB
Plaintext

tests/cases/compiler/constDeclarations-access4.ts(8,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(9,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(10,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(11,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(12,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(13,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(14,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(15,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(16,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(17,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(18,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(19,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(21,1): error TS2449: The operand of an increment or decrement operator cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(22,1): error TS2449: The operand of an increment or decrement operator cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(23,3): error TS2449: The operand of an increment or decrement operator cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(24,3): error TS2449: The operand of an increment or decrement operator cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(26,3): error TS2449: The operand of an increment or decrement operator cannot be a constant.
tests/cases/compiler/constDeclarations-access4.ts(28,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
==== tests/cases/compiler/constDeclarations-access4.ts (18 errors) ====
declare module M {
const x: number;
}
// Errors
M.x = 1;
~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
M.x += 2;
~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
M.x -= 3;
~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
M.x *= 4;
~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
M.x /= 5;
~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
M.x %= 6;
~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
M.x <<= 7;
~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
M.x >>= 8;
~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
M.x >>>= 9;
~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
M.x &= 10;
~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
M.x |= 11;
~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
M.x ^= 12;
~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
M.x++;
~~~
!!! error TS2449: The operand of an increment or decrement operator cannot be a constant.
M.x--;
~~~
!!! error TS2449: The operand of an increment or decrement operator cannot be a constant.
++M.x;
~~~
!!! error TS2449: The operand of an increment or decrement operator cannot be a constant.
--M.x;
~~~
!!! error TS2449: The operand of an increment or decrement operator cannot be a constant.
++((M.x));
~~~~~~~
!!! error TS2449: The operand of an increment or decrement operator cannot be a constant.
M["x"] = 0;
~~~~~~
!!! error TS2450: Left-hand side of assignment expression cannot be a constant.
// OK
var a = M.x + 1;
function f(v: number) { }
f(M.x);
if (M.x) { }
M.x;
(M.x);
-M.x;
+M.x;
M.x.toString();