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