2014-07-13 01:04:16 +02:00
|
|
|
==== tests/cases/compiler/decrementAndIncrementOperators.ts (13 errors) ====
|
|
|
|
var x = 0;
|
|
|
|
|
|
|
|
// errors
|
|
|
|
1 ++;
|
|
|
|
~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
(1)++;
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
(1)--;
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
++(1);
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
--(1);
|
|
|
|
~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
(1 + 2)++;
|
|
|
|
~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
(1 + 2)--;
|
|
|
|
~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
++(1 + 2);
|
|
|
|
~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
--(1 + 2);
|
|
|
|
~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
(x + x)++;
|
|
|
|
~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
(x + x)--;
|
|
|
|
~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
++(x + x);
|
|
|
|
~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
--(x + x);
|
|
|
|
~~~~~~~
|
2014-09-12 00:19:57 +02:00
|
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
2014-07-13 01:04:16 +02:00
|
|
|
|
|
|
|
//OK
|
|
|
|
x++;
|
|
|
|
x--;
|
|
|
|
|
|
|
|
++x;
|
|
|
|
--x;
|
|
|
|
|
|
|
|
(x)++;
|
|
|
|
--(x);
|
|
|
|
|
|
|
|
((x))++;
|
|
|
|
((x))--;
|
|
|
|
|
|
|
|
x[x++]++;
|
|
|
|
|