2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType.ts ===
|
|
|
|
// - operator on enum type
|
|
|
|
|
|
|
|
enum ENUM { };
|
|
|
|
>ENUM : ENUM
|
|
|
|
|
2014-10-07 07:27:22 +02:00
|
|
|
enum ENUM1 { A, B, "" };
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : ENUM1
|
2014-10-07 07:27:22 +02:00
|
|
|
>A : ENUM1
|
|
|
|
>B : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
// enum type var
|
|
|
|
var ResultIsNumber1 = -ENUM;
|
|
|
|
>ResultIsNumber1 : number
|
|
|
|
>-ENUM : number
|
|
|
|
>ENUM : typeof ENUM
|
|
|
|
|
|
|
|
// expressions
|
2014-10-08 20:11:36 +02:00
|
|
|
var ResultIsNumber2 = -ENUM1["B"];
|
2014-08-15 23:33:16 +02:00
|
|
|
>ResultIsNumber2 : number
|
2014-10-08 20:11:36 +02:00
|
|
|
>-ENUM1["B"] : number
|
|
|
|
>ENUM1["B"] : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
|
2014-10-08 20:11:36 +02:00
|
|
|
var ResultIsNumber3 = -(ENUM1.B + ENUM1[""]);
|
2014-08-15 23:33:16 +02:00
|
|
|
>ResultIsNumber3 : number
|
2014-10-08 20:11:36 +02:00
|
|
|
>-(ENUM1.B + ENUM1[""]) : number
|
|
|
|
>(ENUM1.B + ENUM1[""]) : number
|
|
|
|
>ENUM1.B + ENUM1[""] : number
|
|
|
|
>ENUM1.B : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : typeof ENUM1
|
2014-10-08 20:11:36 +02:00
|
|
|
>B : ENUM1
|
|
|
|
>ENUM1[""] : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
|
|
|
|
// miss assignment operators
|
|
|
|
-ENUM;
|
|
|
|
>-ENUM : number
|
|
|
|
>ENUM : typeof ENUM
|
|
|
|
|
|
|
|
-ENUM1;
|
|
|
|
>-ENUM1 : number
|
|
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
|
2014-10-08 20:11:36 +02:00
|
|
|
-ENUM1["B"];
|
|
|
|
>-ENUM1["B"] : number
|
|
|
|
>ENUM1["B"] : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
|
|
|
|
-ENUM, ENUM1;
|
|
|
|
>-ENUM, ENUM1 : typeof ENUM1
|
|
|
|
>-ENUM : number
|
|
|
|
>ENUM : typeof ENUM
|
|
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
|