198 lines
No EOL
16 KiB
Text
198 lines
No EOL
16 KiB
Text
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(24,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(25,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(26,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(27,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(28,25): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(30,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(31,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(32,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(33,23): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(34,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(37,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(38,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(39,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(41,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(42,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(43,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(46,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(47,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(49,27): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,26): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(50,27): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(51,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(52,26): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(54,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(55,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,25): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(57,25): error TS2365: Operator '+' cannot be applied to types 'null' and 'null'.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,24): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(58,25): error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(59,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(60,24): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(63,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(65,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(67,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(68,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(68,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,3): error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
|
|
|
|
==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts (42 errors) ====
|
|
// ++ operator on any type
|
|
var ANY1;
|
|
var ANY2: any[] = [1, 2];
|
|
|
|
var obj: () => {}
|
|
var obj1 = { x: "", y: () => { } };
|
|
function foo(): any {
|
|
var a;
|
|
return a;
|
|
}
|
|
class A {
|
|
public a: any;
|
|
static foo() {
|
|
var a;
|
|
return a;
|
|
}
|
|
}
|
|
module M {
|
|
export var n: any;
|
|
}
|
|
var objA = new A();
|
|
|
|
// any type var
|
|
var ResultIsNumber1 = ++ANY2;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber2 = ++A;
|
|
~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber3 = ++M;
|
|
~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber4 = ++obj;
|
|
~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber5 = ++obj1;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
var ResultIsNumber6 = ANY2++;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber7 = A++;
|
|
~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber8 = M++;
|
|
~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber9 = obj++;
|
|
~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber10 = obj1++;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
// any type literal
|
|
var ResultIsNumber11 = ++{};
|
|
~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber12 = ++null;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber13 = ++undefined;
|
|
~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
var ResultIsNumber14 = null++;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber15 = {}++;
|
|
~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber16 = undefined++;
|
|
~~~~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
// any type expressions
|
|
var ResultIsNumber17 = ++foo();
|
|
~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
var ResultIsNumber18 = ++A.foo();
|
|
~~~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
var ResultIsNumber19 = ++(null + undefined);
|
|
~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
~~~~~~~~~~~~~~~~
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
|
|
var ResultIsNumber20 = ++(null + null);
|
|
~~~~~~~~~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
~~~~~~~~~~~
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'.
|
|
var ResultIsNumber21 = ++(undefined + undefined);
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
|
|
var ResultIsNumber22 = ++obj1.x;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber23 = ++obj1.y;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
var ResultIsNumber24 = foo()++;
|
|
~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
var ResultIsNumber25 = A.foo()++;
|
|
~~~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
var ResultIsNumber26 = (null + undefined)++;
|
|
~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
~~~~~~~~~~~~~~~~
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
|
|
var ResultIsNumber27 = (null + null)++;
|
|
~~~~~~~~~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
~~~~~~~~~~~
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'null'.
|
|
var ResultIsNumber28 = (undefined + undefined)++;
|
|
~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2365: Operator '+' cannot be applied to types 'undefined' and 'undefined'.
|
|
var ResultIsNumber29 = obj1.x++;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
var ResultIsNumber30 = obj1.y++;
|
|
~~~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
// miss assignment operators
|
|
++ANY2;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
ANY2++;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
|
|
++ANY1++;
|
|
~~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
++ANY2++;
|
|
~~~~
|
|
!!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
|
~~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer.
|
|
++ANY2[0]++;
|
|
~~~~~~~~~
|
|
!!! error TS2357: The operand of an increment or decrement operator must be a variable, property or indexer. |