2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithEnumType.ts ===
|
|
|
|
// ~ operator on enum type
|
|
|
|
|
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 = ~ENUM1;
|
|
|
|
>ResultIsNumber1 : number
|
|
|
|
>~ENUM1 : number
|
|
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
|
|
|
|
// enum type expressions
|
2014-10-08 20:11:36 +02:00
|
|
|
var ResultIsNumber2 = ~ENUM1["A"];
|
2014-08-15 23:33:16 +02:00
|
|
|
>ResultIsNumber2 : number
|
2014-10-08 20:11:36 +02:00
|
|
|
>~ENUM1["A"] : number
|
|
|
|
>ENUM1["A"] : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
|
2014-10-08 20:11:36 +02:00
|
|
|
var ResultIsNumber3 = ~(ENUM1.A + ENUM1["B"]);
|
2014-08-15 23:33:16 +02:00
|
|
|
>ResultIsNumber3 : number
|
2014-10-08 20:11:36 +02:00
|
|
|
>~(ENUM1.A + ENUM1["B"]) : number
|
|
|
|
>(ENUM1.A + ENUM1["B"]) : number
|
|
|
|
>ENUM1.A + ENUM1["B"] : number
|
|
|
|
>ENUM1.A : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : typeof ENUM1
|
2014-10-08 20:11:36 +02:00
|
|
|
>A : ENUM1
|
|
|
|
>ENUM1["B"] : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
|
|
|
|
// multiple ~ operators
|
2014-10-08 20:11:36 +02:00
|
|
|
var ResultIsNumber4 = ~~~(ENUM1["A"] + ENUM1.B);
|
2014-08-15 23:33:16 +02:00
|
|
|
>ResultIsNumber4 : number
|
2014-10-08 20:11:36 +02:00
|
|
|
>~~~(ENUM1["A"] + ENUM1.B) : number
|
|
|
|
>~~(ENUM1["A"] + ENUM1.B) : number
|
|
|
|
>~(ENUM1["A"] + ENUM1.B) : number
|
|
|
|
>(ENUM1["A"] + ENUM1.B) : number
|
|
|
|
>ENUM1["A"] + ENUM1.B : number
|
|
|
|
>ENUM1["A"] : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : typeof ENUM1
|
2014-10-08 20:11:36 +02:00
|
|
|
>ENUM1.B : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : typeof ENUM1
|
2014-10-08 20:11:36 +02:00
|
|
|
>B : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
// miss assignment operators
|
|
|
|
~ENUM1;
|
|
|
|
>~ENUM1 : number
|
|
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
|
2014-10-08 20:11:36 +02:00
|
|
|
~ENUM1["A"];
|
|
|
|
>~ENUM1["A"] : number
|
|
|
|
>ENUM1["A"] : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
|
2014-10-08 20:11:36 +02:00
|
|
|
~ENUM1.A, ~ENUM1["B"];
|
|
|
|
>~ENUM1.A, ~ENUM1["B"] : number
|
|
|
|
>~ENUM1.A : number
|
|
|
|
>ENUM1.A : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : typeof ENUM1
|
2014-10-08 20:11:36 +02:00
|
|
|
>A : ENUM1
|
|
|
|
>~ENUM1["B"] : number
|
|
|
|
>ENUM1["B"] : ENUM1
|
2014-08-15 23:33:16 +02:00
|
|
|
>ENUM1 : typeof ENUM1
|
|
|
|
|