TypeScript/tests/baselines/reference/negateOperatorWithBooleanType.types

114 lines
4.2 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithBooleanType.ts ===
// - operator on boolean type
var BOOLEAN: boolean;
2015-04-13 23:01:57 +02:00
>BOOLEAN : boolean, Symbol(BOOLEAN, Decl(negateOperatorWithBooleanType.ts, 1, 3))
2014-08-15 23:33:16 +02:00
function foo(): boolean { return true; }
2015-04-13 23:01:57 +02:00
>foo : () => boolean, Symbol(foo, Decl(negateOperatorWithBooleanType.ts, 1, 21))
2015-04-13 21:36:11 +02:00
>true : boolean
2014-08-15 23:33:16 +02:00
class A {
2015-04-13 23:01:57 +02:00
>A : A, Symbol(A, Decl(negateOperatorWithBooleanType.ts, 3, 40))
2014-08-15 23:33:16 +02:00
public a: boolean;
2015-04-13 23:01:57 +02:00
>a : boolean, Symbol(a, Decl(negateOperatorWithBooleanType.ts, 5, 9))
2014-08-15 23:33:16 +02:00
static foo() { return false; }
2015-04-13 23:01:57 +02:00
>foo : () => boolean, Symbol(A.foo, Decl(negateOperatorWithBooleanType.ts, 6, 22))
2015-04-13 21:36:11 +02:00
>false : boolean
2014-08-15 23:33:16 +02:00
}
module M {
2015-04-13 23:01:57 +02:00
>M : typeof M, Symbol(M, Decl(negateOperatorWithBooleanType.ts, 8, 1))
2014-08-15 23:33:16 +02:00
export var n: boolean;
2015-04-13 23:01:57 +02:00
>n : boolean, Symbol(n, Decl(negateOperatorWithBooleanType.ts, 10, 14))
2014-08-15 23:33:16 +02:00
}
var objA = new A();
2015-04-13 23:01:57 +02:00
>objA : A, Symbol(objA, Decl(negateOperatorWithBooleanType.ts, 13, 3))
2014-08-15 23:33:16 +02:00
>new A() : A
2015-04-13 23:01:57 +02:00
>A : typeof A, Symbol(A, Decl(negateOperatorWithBooleanType.ts, 3, 40))
2014-08-15 23:33:16 +02:00
// boolean type var
var ResultIsNumber1 = -BOOLEAN;
2015-04-13 23:01:57 +02:00
>ResultIsNumber1 : number, Symbol(ResultIsNumber1, Decl(negateOperatorWithBooleanType.ts, 16, 3))
2014-08-15 23:33:16 +02:00
>-BOOLEAN : number
2015-04-13 23:01:57 +02:00
>BOOLEAN : boolean, Symbol(BOOLEAN, Decl(negateOperatorWithBooleanType.ts, 1, 3))
2014-08-15 23:33:16 +02:00
// boolean type literal
var ResultIsNumber2 = -true;
2015-04-13 23:01:57 +02:00
>ResultIsNumber2 : number, Symbol(ResultIsNumber2, Decl(negateOperatorWithBooleanType.ts, 19, 3))
2014-08-15 23:33:16 +02:00
>-true : number
2015-04-13 21:36:11 +02:00
>true : boolean
2014-08-15 23:33:16 +02:00
var ResultIsNumber3 = -{ x: true, y: false };
2015-04-13 23:01:57 +02:00
>ResultIsNumber3 : number, Symbol(ResultIsNumber3, Decl(negateOperatorWithBooleanType.ts, 20, 3))
2014-08-15 23:33:16 +02:00
>-{ x: true, y: false } : number
>{ x: true, y: false } : { x: boolean; y: boolean; }
2015-04-13 23:01:57 +02:00
>x : boolean, Symbol(x, Decl(negateOperatorWithBooleanType.ts, 20, 24))
2015-04-13 21:36:11 +02:00
>true : boolean
2015-04-13 23:01:57 +02:00
>y : boolean, Symbol(y, Decl(negateOperatorWithBooleanType.ts, 20, 33))
2015-04-13 21:36:11 +02:00
>false : boolean
2014-08-15 23:33:16 +02:00
// boolean type expressions
var ResultIsNumber4 = -objA.a;
2015-04-13 23:01:57 +02:00
>ResultIsNumber4 : number, Symbol(ResultIsNumber4, Decl(negateOperatorWithBooleanType.ts, 23, 3))
2014-08-15 23:33:16 +02:00
>-objA.a : number
2015-04-13 23:01:57 +02:00
>objA.a : boolean, Symbol(A.a, Decl(negateOperatorWithBooleanType.ts, 5, 9))
>objA : A, Symbol(objA, Decl(negateOperatorWithBooleanType.ts, 13, 3))
>a : boolean, Symbol(A.a, Decl(negateOperatorWithBooleanType.ts, 5, 9))
2014-08-15 23:33:16 +02:00
var ResultIsNumber5 = -M.n;
2015-04-13 23:01:57 +02:00
>ResultIsNumber5 : number, Symbol(ResultIsNumber5, Decl(negateOperatorWithBooleanType.ts, 24, 3))
2014-08-15 23:33:16 +02:00
>-M.n : number
2015-04-13 23:01:57 +02:00
>M.n : boolean, Symbol(M.n, Decl(negateOperatorWithBooleanType.ts, 10, 14))
>M : typeof M, Symbol(M, Decl(negateOperatorWithBooleanType.ts, 8, 1))
>n : boolean, Symbol(M.n, Decl(negateOperatorWithBooleanType.ts, 10, 14))
2014-08-15 23:33:16 +02:00
var ResultIsNumber6 = -foo();
2015-04-13 23:01:57 +02:00
>ResultIsNumber6 : number, Symbol(ResultIsNumber6, Decl(negateOperatorWithBooleanType.ts, 25, 3))
2014-08-15 23:33:16 +02:00
>-foo() : number
>foo() : boolean
2015-04-13 23:01:57 +02:00
>foo : () => boolean, Symbol(foo, Decl(negateOperatorWithBooleanType.ts, 1, 21))
2014-08-15 23:33:16 +02:00
var ResultIsNumber7 = -A.foo();
2015-04-13 23:01:57 +02:00
>ResultIsNumber7 : number, Symbol(ResultIsNumber7, Decl(negateOperatorWithBooleanType.ts, 26, 3))
2014-08-15 23:33:16 +02:00
>-A.foo() : number
>A.foo() : boolean
2015-04-13 23:01:57 +02:00
>A.foo : () => boolean, Symbol(A.foo, Decl(negateOperatorWithBooleanType.ts, 6, 22))
>A : typeof A, Symbol(A, Decl(negateOperatorWithBooleanType.ts, 3, 40))
>foo : () => boolean, Symbol(A.foo, Decl(negateOperatorWithBooleanType.ts, 6, 22))
2014-08-15 23:33:16 +02:00
// miss assignment operators
-true;
>-true : number
2015-04-13 21:36:11 +02:00
>true : boolean
2014-08-15 23:33:16 +02:00
-BOOLEAN;
>-BOOLEAN : number
2015-04-13 23:01:57 +02:00
>BOOLEAN : boolean, Symbol(BOOLEAN, Decl(negateOperatorWithBooleanType.ts, 1, 3))
2014-08-15 23:33:16 +02:00
-foo();
>-foo() : number
>foo() : boolean
2015-04-13 23:01:57 +02:00
>foo : () => boolean, Symbol(foo, Decl(negateOperatorWithBooleanType.ts, 1, 21))
2014-08-15 23:33:16 +02:00
-true, false;
>-true, false : boolean
>-true : number
2015-04-13 21:36:11 +02:00
>true : boolean
>false : boolean
2014-08-15 23:33:16 +02:00
-objA.a;
>-objA.a : number
2015-04-13 23:01:57 +02:00
>objA.a : boolean, Symbol(A.a, Decl(negateOperatorWithBooleanType.ts, 5, 9))
>objA : A, Symbol(objA, Decl(negateOperatorWithBooleanType.ts, 13, 3))
>a : boolean, Symbol(A.a, Decl(negateOperatorWithBooleanType.ts, 5, 9))
2014-08-15 23:33:16 +02:00
-M.n;
>-M.n : number
2015-04-13 23:01:57 +02:00
>M.n : boolean, Symbol(M.n, Decl(negateOperatorWithBooleanType.ts, 10, 14))
>M : typeof M, Symbol(M, Decl(negateOperatorWithBooleanType.ts, 8, 1))
>n : boolean, Symbol(M.n, Decl(negateOperatorWithBooleanType.ts, 10, 14))
2014-08-15 23:33:16 +02:00