TypeScript/tests/baselines/reference/typeofOperatorWithBooleanType.symbols
2015-04-15 16:44:20 -07:00

130 lines
5.2 KiB
Text

=== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithBooleanType.ts ===
// typeof operator on boolean type
var BOOLEAN: boolean;
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 1, 3))
function foo(): boolean { return true; }
>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 1, 21))
class A {
>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 3, 40))
public a: boolean;
>a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 5, 9))
static foo() { return false; }
>foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 6, 22))
}
module M {
>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 8, 1))
export var n: boolean;
>n : Symbol(n, Decl(typeofOperatorWithBooleanType.ts, 10, 14))
}
var objA = new A();
>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 13, 3))
>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 3, 40))
// boolean type var
var ResultIsString1 = typeof BOOLEAN;
>ResultIsString1 : Symbol(ResultIsString1, Decl(typeofOperatorWithBooleanType.ts, 16, 3))
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 1, 3))
// boolean type literal
var ResultIsString2 = typeof true;
>ResultIsString2 : Symbol(ResultIsString2, Decl(typeofOperatorWithBooleanType.ts, 19, 3))
var ResultIsString3 = typeof { x: true, y: false };
>ResultIsString3 : Symbol(ResultIsString3, Decl(typeofOperatorWithBooleanType.ts, 20, 3))
>x : Symbol(x, Decl(typeofOperatorWithBooleanType.ts, 20, 30))
>y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 20, 39))
// boolean type expressions
var ResultIsString4 = typeof objA.a;
>ResultIsString4 : Symbol(ResultIsString4, Decl(typeofOperatorWithBooleanType.ts, 23, 3))
>objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 5, 9))
>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 13, 3))
>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 5, 9))
var ResultIsString5 = typeof M.n;
>ResultIsString5 : Symbol(ResultIsString5, Decl(typeofOperatorWithBooleanType.ts, 24, 3))
>M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 10, 14))
>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 8, 1))
>n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 10, 14))
var ResultIsString6 = typeof foo();
>ResultIsString6 : Symbol(ResultIsString6, Decl(typeofOperatorWithBooleanType.ts, 25, 3))
>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 1, 21))
var ResultIsString7 = typeof A.foo();
>ResultIsString7 : Symbol(ResultIsString7, Decl(typeofOperatorWithBooleanType.ts, 26, 3))
>A.foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 6, 22))
>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 3, 40))
>foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 6, 22))
// multiple typeof operator
var ResultIsString8 = typeof typeof BOOLEAN;
>ResultIsString8 : Symbol(ResultIsString8, Decl(typeofOperatorWithBooleanType.ts, 29, 3))
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 1, 3))
// miss assignment operators
typeof true;
typeof BOOLEAN;
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 1, 3))
typeof foo();
>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 1, 21))
typeof true, false;
typeof objA.a;
>objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 5, 9))
>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 13, 3))
>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 5, 9))
typeof M.n;
>M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 10, 14))
>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 8, 1))
>n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 10, 14))
// use typeof in type query
var z: boolean;
>z : Symbol(z, Decl(typeofOperatorWithBooleanType.ts, 40, 3))
var x: boolean[];
>x : Symbol(x, Decl(typeofOperatorWithBooleanType.ts, 41, 3))
var r: () => boolean;
>r : Symbol(r, Decl(typeofOperatorWithBooleanType.ts, 42, 3))
z: typeof BOOLEAN;
>BOOLEAN : Symbol(BOOLEAN, Decl(typeofOperatorWithBooleanType.ts, 1, 3))
r: typeof foo;
>foo : Symbol(foo, Decl(typeofOperatorWithBooleanType.ts, 1, 21))
var y = { a: true, b: false};
>y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 45, 3))
>a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 45, 9))
>b : Symbol(b, Decl(typeofOperatorWithBooleanType.ts, 45, 18))
z: typeof y.a;
>y.a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 45, 9))
>y : Symbol(y, Decl(typeofOperatorWithBooleanType.ts, 45, 3))
>a : Symbol(a, Decl(typeofOperatorWithBooleanType.ts, 45, 9))
z: typeof objA.a;
>objA.a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 5, 9))
>objA : Symbol(objA, Decl(typeofOperatorWithBooleanType.ts, 13, 3))
>a : Symbol(A.a, Decl(typeofOperatorWithBooleanType.ts, 5, 9))
z: typeof A.foo;
>A.foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 6, 22))
>A : Symbol(A, Decl(typeofOperatorWithBooleanType.ts, 3, 40))
>foo : Symbol(A.foo, Decl(typeofOperatorWithBooleanType.ts, 6, 22))
z: typeof M.n;
>M.n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 10, 14))
>M : Symbol(M, Decl(typeofOperatorWithBooleanType.ts, 8, 1))
>n : Symbol(M.n, Decl(typeofOperatorWithBooleanType.ts, 10, 14))