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

168 lines
7.1 KiB
Plaintext

=== tests/cases/conformance/expressions/unaryOperators/typeofOperator/typeofOperatorWithStringType.ts ===
// typeof operator on string type
var STRING: string;
>STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3))
var STRING1: string[] = ["", "abc"];
>STRING1 : Symbol(STRING1, Decl(typeofOperatorWithStringType.ts, 2, 3))
function foo(): string { return "abc"; }
>foo : Symbol(foo, Decl(typeofOperatorWithStringType.ts, 2, 36))
class A {
>A : Symbol(A, Decl(typeofOperatorWithStringType.ts, 4, 40))
public a: string;
>a : Symbol(a, Decl(typeofOperatorWithStringType.ts, 6, 9))
static foo() { return ""; }
>foo : Symbol(A.foo, Decl(typeofOperatorWithStringType.ts, 7, 21))
}
module M {
>M : Symbol(M, Decl(typeofOperatorWithStringType.ts, 9, 1))
export var n: string;
>n : Symbol(n, Decl(typeofOperatorWithStringType.ts, 11, 14))
}
var objA = new A();
>objA : Symbol(objA, Decl(typeofOperatorWithStringType.ts, 14, 3))
>A : Symbol(A, Decl(typeofOperatorWithStringType.ts, 4, 40))
// string type var
var ResultIsString1 = typeof STRING;
>ResultIsString1 : Symbol(ResultIsString1, Decl(typeofOperatorWithStringType.ts, 17, 3))
>STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3))
var ResultIsString2 = typeof STRING1;
>ResultIsString2 : Symbol(ResultIsString2, Decl(typeofOperatorWithStringType.ts, 18, 3))
>STRING1 : Symbol(STRING1, Decl(typeofOperatorWithStringType.ts, 2, 3))
// string type literal
var ResultIsString3 = typeof "";
>ResultIsString3 : Symbol(ResultIsString3, Decl(typeofOperatorWithStringType.ts, 21, 3))
var ResultIsString4 = typeof { x: "", y: "" };
>ResultIsString4 : Symbol(ResultIsString4, Decl(typeofOperatorWithStringType.ts, 22, 3))
>x : Symbol(x, Decl(typeofOperatorWithStringType.ts, 22, 30))
>y : Symbol(y, Decl(typeofOperatorWithStringType.ts, 22, 37))
var ResultIsString5 = typeof { x: "", y: (s: string) => { return s; } };
>ResultIsString5 : Symbol(ResultIsString5, Decl(typeofOperatorWithStringType.ts, 23, 3))
>x : Symbol(x, Decl(typeofOperatorWithStringType.ts, 23, 30))
>y : Symbol(y, Decl(typeofOperatorWithStringType.ts, 23, 37))
>s : Symbol(s, Decl(typeofOperatorWithStringType.ts, 23, 42))
>s : Symbol(s, Decl(typeofOperatorWithStringType.ts, 23, 42))
// string type expressions
var ResultIsString6 = typeof objA.a;
>ResultIsString6 : Symbol(ResultIsString6, Decl(typeofOperatorWithStringType.ts, 26, 3))
>objA.a : Symbol(A.a, Decl(typeofOperatorWithStringType.ts, 6, 9))
>objA : Symbol(objA, Decl(typeofOperatorWithStringType.ts, 14, 3))
>a : Symbol(A.a, Decl(typeofOperatorWithStringType.ts, 6, 9))
var ResultIsString7 = typeof M.n;
>ResultIsString7 : Symbol(ResultIsString7, Decl(typeofOperatorWithStringType.ts, 27, 3))
>M.n : Symbol(M.n, Decl(typeofOperatorWithStringType.ts, 11, 14))
>M : Symbol(M, Decl(typeofOperatorWithStringType.ts, 9, 1))
>n : Symbol(M.n, Decl(typeofOperatorWithStringType.ts, 11, 14))
var ResultIsString8 = typeof STRING1[0];
>ResultIsString8 : Symbol(ResultIsString8, Decl(typeofOperatorWithStringType.ts, 28, 3))
>STRING1 : Symbol(STRING1, Decl(typeofOperatorWithStringType.ts, 2, 3))
var ResultIsString9 = typeof foo();
>ResultIsString9 : Symbol(ResultIsString9, Decl(typeofOperatorWithStringType.ts, 29, 3))
>foo : Symbol(foo, Decl(typeofOperatorWithStringType.ts, 2, 36))
var ResultIsString10 = typeof A.foo();
>ResultIsString10 : Symbol(ResultIsString10, Decl(typeofOperatorWithStringType.ts, 30, 3))
>A.foo : Symbol(A.foo, Decl(typeofOperatorWithStringType.ts, 7, 21))
>A : Symbol(A, Decl(typeofOperatorWithStringType.ts, 4, 40))
>foo : Symbol(A.foo, Decl(typeofOperatorWithStringType.ts, 7, 21))
var ResultIsString11 = typeof (STRING + STRING);
>ResultIsString11 : Symbol(ResultIsString11, Decl(typeofOperatorWithStringType.ts, 31, 3))
>STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3))
>STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3))
var ResultIsString12 = typeof STRING.charAt(0);
>ResultIsString12 : Symbol(ResultIsString12, Decl(typeofOperatorWithStringType.ts, 32, 3))
>STRING.charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
// multiple typeof operators
var ResultIsString13 = typeof typeof STRING;
>ResultIsString13 : Symbol(ResultIsString13, Decl(typeofOperatorWithStringType.ts, 35, 3))
>STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3))
var ResultIsString14 = typeof typeof typeof (STRING + STRING);
>ResultIsString14 : Symbol(ResultIsString14, Decl(typeofOperatorWithStringType.ts, 36, 3))
>STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3))
>STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3))
// miss assignment operators
typeof "";
typeof STRING;
>STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3))
typeof STRING1;
>STRING1 : Symbol(STRING1, Decl(typeofOperatorWithStringType.ts, 2, 3))
typeof foo();
>foo : Symbol(foo, Decl(typeofOperatorWithStringType.ts, 2, 36))
typeof objA.a, M.n;
>objA.a : Symbol(A.a, Decl(typeofOperatorWithStringType.ts, 6, 9))
>objA : Symbol(objA, Decl(typeofOperatorWithStringType.ts, 14, 3))
>a : Symbol(A.a, Decl(typeofOperatorWithStringType.ts, 6, 9))
>M.n : Symbol(M.n, Decl(typeofOperatorWithStringType.ts, 11, 14))
>M : Symbol(M, Decl(typeofOperatorWithStringType.ts, 9, 1))
>n : Symbol(M.n, Decl(typeofOperatorWithStringType.ts, 11, 14))
// use typeof in type query
var z: string;
>z : Symbol(z, Decl(typeofOperatorWithStringType.ts, 46, 3))
var x: string[];
>x : Symbol(x, Decl(typeofOperatorWithStringType.ts, 47, 3))
var r: () => string;
>r : Symbol(r, Decl(typeofOperatorWithStringType.ts, 48, 3))
z: typeof STRING;
>STRING : Symbol(STRING, Decl(typeofOperatorWithStringType.ts, 1, 3))
x: typeof STRING1;
>STRING1 : Symbol(STRING1, Decl(typeofOperatorWithStringType.ts, 2, 3))
r: typeof foo;
>foo : Symbol(foo, Decl(typeofOperatorWithStringType.ts, 2, 36))
var y = { a: "", b: "" };
>y : Symbol(y, Decl(typeofOperatorWithStringType.ts, 52, 3))
>a : Symbol(a, Decl(typeofOperatorWithStringType.ts, 52, 9))
>b : Symbol(b, Decl(typeofOperatorWithStringType.ts, 52, 16))
z: typeof y.a;
>y.a : Symbol(a, Decl(typeofOperatorWithStringType.ts, 52, 9))
>y : Symbol(y, Decl(typeofOperatorWithStringType.ts, 52, 3))
>a : Symbol(a, Decl(typeofOperatorWithStringType.ts, 52, 9))
z: typeof objA.a;
>objA.a : Symbol(A.a, Decl(typeofOperatorWithStringType.ts, 6, 9))
>objA : Symbol(objA, Decl(typeofOperatorWithStringType.ts, 14, 3))
>a : Symbol(A.a, Decl(typeofOperatorWithStringType.ts, 6, 9))
z: typeof A.foo;
>A.foo : Symbol(A.foo, Decl(typeofOperatorWithStringType.ts, 7, 21))
>A : Symbol(A, Decl(typeofOperatorWithStringType.ts, 4, 40))
>foo : Symbol(A.foo, Decl(typeofOperatorWithStringType.ts, 7, 21))
z: typeof M.n;
>M.n : Symbol(M.n, Decl(typeofOperatorWithStringType.ts, 11, 14))
>M : Symbol(M, Decl(typeofOperatorWithStringType.ts, 9, 1))
>n : Symbol(M.n, Decl(typeofOperatorWithStringType.ts, 11, 14))