TypeScript/tests/baselines/reference/negateOperatorWithEnumType.types

58 lines
2.3 KiB
Text

=== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithEnumType.ts ===
// - operator on enum type
enum ENUM { };
>ENUM : ENUM, Symbol(ENUM,Decl(negateOperatorWithEnumType.ts,0,0))
enum ENUM1 { A, B, "" };
>ENUM1 : ENUM1, Symbol(ENUM1,Decl(negateOperatorWithEnumType.ts,2,14))
>A : ENUM1, Symbol(ENUM1.A,Decl(negateOperatorWithEnumType.ts,3,12))
>B : ENUM1, Symbol(ENUM1.B,Decl(negateOperatorWithEnumType.ts,3,15))
// enum type var
var ResultIsNumber1 = -ENUM;
>ResultIsNumber1 : number, Symbol(ResultIsNumber1,Decl(negateOperatorWithEnumType.ts,6,3))
>-ENUM : number
>ENUM : typeof ENUM, Symbol(ENUM,Decl(negateOperatorWithEnumType.ts,0,0))
// expressions
var ResultIsNumber2 = -ENUM1["B"];
>ResultIsNumber2 : number, Symbol(ResultIsNumber2,Decl(negateOperatorWithEnumType.ts,9,3))
>-ENUM1["B"] : number
>ENUM1["B"] : ENUM1
>ENUM1 : typeof ENUM1, Symbol(ENUM1,Decl(negateOperatorWithEnumType.ts,2,14))
>"B" : string, Symbol(ENUM1.B,Decl(negateOperatorWithEnumType.ts,3,15))
var ResultIsNumber3 = -(ENUM1.B + ENUM1[""]);
>ResultIsNumber3 : number, Symbol(ResultIsNumber3,Decl(negateOperatorWithEnumType.ts,10,3))
>-(ENUM1.B + ENUM1[""]) : number
>(ENUM1.B + ENUM1[""]) : number
>ENUM1.B + ENUM1[""] : number
>ENUM1.B : ENUM1, Symbol(ENUM1.B,Decl(negateOperatorWithEnumType.ts,3,15))
>ENUM1 : typeof ENUM1, Symbol(ENUM1,Decl(negateOperatorWithEnumType.ts,2,14))
>B : ENUM1, Symbol(ENUM1.B,Decl(negateOperatorWithEnumType.ts,3,15))
>ENUM1[""] : ENUM1
>ENUM1 : typeof ENUM1, Symbol(ENUM1,Decl(negateOperatorWithEnumType.ts,2,14))
>"" : string, Symbol(ENUM1."",Decl(negateOperatorWithEnumType.ts,3,18))
// miss assignment operators
-ENUM;
>-ENUM : number
>ENUM : typeof ENUM, Symbol(ENUM,Decl(negateOperatorWithEnumType.ts,0,0))
-ENUM1;
>-ENUM1 : number
>ENUM1 : typeof ENUM1, Symbol(ENUM1,Decl(negateOperatorWithEnumType.ts,2,14))
-ENUM1["B"];
>-ENUM1["B"] : number
>ENUM1["B"] : ENUM1
>ENUM1 : typeof ENUM1, Symbol(ENUM1,Decl(negateOperatorWithEnumType.ts,2,14))
>"B" : string, Symbol(ENUM1.B,Decl(negateOperatorWithEnumType.ts,3,15))
-ENUM, ENUM1;
>-ENUM, ENUM1 : typeof ENUM1
>-ENUM : number
>ENUM : typeof ENUM, Symbol(ENUM,Decl(negateOperatorWithEnumType.ts,0,0))
>ENUM1 : typeof ENUM1, Symbol(ENUM1,Decl(negateOperatorWithEnumType.ts,2,14))