TypeScript/tests/baselines/reference/incrementOperatorWithAnyOtherTypeInvalidOperations.errors.txt
Hai Lin Zhang e44d39d4eb
Updated error message for TS2539 (#39827)
* Updated error message for TS2539

* Switch to multiple error messages

* inline variable

Co-authored-by: Nathan Shively-Sanders <293473+sandersn@users.noreply.github.com>
2021-03-11 15:51:15 -08:00

213 lines
17 KiB
Plaintext

tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(24,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(25,25): error TS2629: Cannot assign to 'A' because it is a class.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(26,25): error TS2631: Cannot assign to 'M' because it is a namespace.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(27,25): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' 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', 'bigint' 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', 'bigint' or an enum type.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(31,23): error TS2629: Cannot assign to 'A' because it is a class.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(32,23): error TS2631: Cannot assign to 'M' because it is a namespace.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(33,23): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' 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', 'bigint' 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', 'bigint' or an enum type.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(38,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(38,26): error TS2531: Object is possibly 'null'.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(39,26): error TS2539: Cannot assign to 'undefined' because it is not a variable.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(41,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(41,24): error TS2531: Object is possibly 'null'.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(42,24): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(43,24): error TS2539: Cannot assign to 'undefined' because it is not a variable.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(46,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(47,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,26): error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(48,27): error TS2365: Operator '+' cannot be applied to types 'null' 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 or a property access.
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 or a property access.
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', 'bigint' 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', 'bigint' 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 or a property access.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(55,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,24): error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(56,25): error TS2365: Operator '+' cannot be applied to types 'null' 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 or a property access.
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 or a property access.
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', 'bigint' 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', 'bigint' 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', 'bigint' 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', 'bigint' or an enum type.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(67,7): error TS1005: ';' expected.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(67,9): error TS1109: Expression expected.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(68,3): error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(68,7): error TS1005: ';' expected.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(68,9): error TS1109: Expression expected.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,10): error TS1005: ';' expected.
tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts(69,12): error TS1109: Expression expected.
==== tests/cases/conformance/expressions/unaryOperators/incrementOperator/incrementOperatorWithAnyOtherTypeInvalidOperations.ts (47 errors) ====
// ++ operator on any type
var ANY1: any;
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(): any {
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', 'bigint' or an enum type.
var ResultIsNumber2 = ++A;
~
!!! error TS2629: Cannot assign to 'A' because it is a class.
var ResultIsNumber3 = ++M;
~
!!! error TS2631: Cannot assign to 'M' because it is a namespace.
var ResultIsNumber4 = ++obj;
~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
var ResultIsNumber5 = ++obj1;
~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
var ResultIsNumber6 = ANY2++;
~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
var ResultIsNumber7 = A++;
~
!!! error TS2629: Cannot assign to 'A' because it is a class.
var ResultIsNumber8 = M++;
~
!!! error TS2631: Cannot assign to 'M' because it is a namespace.
var ResultIsNumber9 = obj++;
~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
var ResultIsNumber10 = obj1++;
~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
// any type literal
var ResultIsNumber11 = ++{};
~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
var ResultIsNumber12 = ++null;
~~~~
!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
~~~~
!!! error TS2531: Object is possibly 'null'.
var ResultIsNumber13 = ++undefined;
~~~~~~~~~
!!! error TS2539: Cannot assign to 'undefined' because it is not a variable.
var ResultIsNumber14 = null++;
~~~~
!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
~~~~
!!! error TS2531: Object is possibly 'null'.
var ResultIsNumber15 = {}++;
~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
var ResultIsNumber16 = undefined++;
~~~~~~~~~
!!! error TS2539: Cannot assign to 'undefined' because it is not a variable.
// any type expressions
var ResultIsNumber17 = ++foo();
~~~~~
!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
var ResultIsNumber18 = ++A.foo();
~~~~~~~
!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
var ResultIsNumber19 = ++(null + undefined);
~~~~~~~~~~~~~~~~~~
!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'undefined'.
var ResultIsNumber20 = ++(null + null);
~~~~~~~~~~~~~
!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
~~~~~~~~~~~
!!! 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 or a property access.
~~~~~~~~~~~~~~~~~~~~~
!!! 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', 'bigint' or an enum type.
var ResultIsNumber23 = ++obj1.y;
~~~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
var ResultIsNumber24 = foo()++;
~~~~~
!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
var ResultIsNumber25 = A.foo()++;
~~~~~~~
!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
var ResultIsNumber26 = (null + undefined)++;
~~~~~~~~~~~~~~~~~~
!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
~~~~~~~~~~~~~~~~
!!! error TS2365: Operator '+' cannot be applied to types 'null' and 'undefined'.
var ResultIsNumber27 = (null + null)++;
~~~~~~~~~~~~~
!!! error TS2357: The operand of an increment or decrement operator must be a variable or a property access.
~~~~~~~~~~~
!!! 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 or a property access.
~~~~~~~~~~~~~~~~~~~~~
!!! 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', 'bigint' or an enum type.
var ResultIsNumber30 = obj1.y++;
~~~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
// miss assignment operators
++ANY2;
~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
ANY2++;
~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
++ANY1++;
~~
!!! error TS1005: ';' expected.
~
!!! error TS1109: Expression expected.
++ANY2++;
~~~~
!!! error TS2356: An arithmetic operand must be of type 'any', 'number', 'bigint' or an enum type.
~~
!!! error TS1005: ';' expected.
~
!!! error TS1109: Expression expected.
++ANY2[0]++;
~~
!!! error TS1005: ';' expected.
~
!!! error TS1109: Expression expected.