TypeScript/tests/baselines/reference/plusOperatorWithBooleanType.types
2015-04-13 14:29:37 -07:00

114 lines
4.1 KiB
Plaintext

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