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

173 lines
7.3 KiB
Plaintext

=== tests/cases/conformance/expressions/unaryOperators/logicalNotOperator/logicalNotOperatorWithStringType.ts ===
// ! operator on string type
var STRING: string;
>STRING : string, Symbol(STRING, Decl(logicalNotOperatorWithStringType.ts, 1, 3))
var STRING1: string[] = ["", "abc"];
>STRING1 : string[], Symbol(STRING1, Decl(logicalNotOperatorWithStringType.ts, 2, 3))
>["", "abc"] : string[]
>"" : string
>"abc" : string
function foo(): string { return "abc"; }
>foo : () => string, Symbol(foo, Decl(logicalNotOperatorWithStringType.ts, 2, 36))
>"abc" : string
class A {
>A : A, Symbol(A, Decl(logicalNotOperatorWithStringType.ts, 4, 40))
public a: string;
>a : string, Symbol(a, Decl(logicalNotOperatorWithStringType.ts, 6, 9))
static foo() { return ""; }
>foo : () => string, Symbol(A.foo, Decl(logicalNotOperatorWithStringType.ts, 7, 21))
>"" : string
}
module M {
>M : typeof M, Symbol(M, Decl(logicalNotOperatorWithStringType.ts, 9, 1))
export var n: string;
>n : string, Symbol(n, Decl(logicalNotOperatorWithStringType.ts, 11, 14))
}
var objA = new A();
>objA : A, Symbol(objA, Decl(logicalNotOperatorWithStringType.ts, 14, 3))
>new A() : A
>A : typeof A, Symbol(A, Decl(logicalNotOperatorWithStringType.ts, 4, 40))
// string type var
var ResultIsBoolean1 = !STRING;
>ResultIsBoolean1 : boolean, Symbol(ResultIsBoolean1, Decl(logicalNotOperatorWithStringType.ts, 17, 3))
>!STRING : boolean
>STRING : string, Symbol(STRING, Decl(logicalNotOperatorWithStringType.ts, 1, 3))
var ResultIsBoolean2 = !STRING1;
>ResultIsBoolean2 : boolean, Symbol(ResultIsBoolean2, Decl(logicalNotOperatorWithStringType.ts, 18, 3))
>!STRING1 : boolean
>STRING1 : string[], Symbol(STRING1, Decl(logicalNotOperatorWithStringType.ts, 2, 3))
// string type literal
var ResultIsBoolean3 = !"";
>ResultIsBoolean3 : boolean, Symbol(ResultIsBoolean3, Decl(logicalNotOperatorWithStringType.ts, 21, 3))
>!"" : boolean
>"" : string
var ResultIsBoolean4 = !{ x: "", y: "" };
>ResultIsBoolean4 : boolean, Symbol(ResultIsBoolean4, Decl(logicalNotOperatorWithStringType.ts, 22, 3))
>!{ x: "", y: "" } : boolean
>{ x: "", y: "" } : { x: string; y: string; }
>x : string, Symbol(x, Decl(logicalNotOperatorWithStringType.ts, 22, 25))
>"" : string
>y : string, Symbol(y, Decl(logicalNotOperatorWithStringType.ts, 22, 32))
>"" : string
var ResultIsBoolean5 = !{ x: "", y: (s: string) => { return s; } };
>ResultIsBoolean5 : boolean, Symbol(ResultIsBoolean5, Decl(logicalNotOperatorWithStringType.ts, 23, 3))
>!{ x: "", y: (s: string) => { return s; } } : boolean
>{ x: "", y: (s: string) => { return s; } } : { x: string; y: (s: string) => string; }
>x : string, Symbol(x, Decl(logicalNotOperatorWithStringType.ts, 23, 25))
>"" : string
>y : (s: string) => string, Symbol(y, Decl(logicalNotOperatorWithStringType.ts, 23, 32))
>(s: string) => { return s; } : (s: string) => string
>s : string, Symbol(s, Decl(logicalNotOperatorWithStringType.ts, 23, 37))
>s : string, Symbol(s, Decl(logicalNotOperatorWithStringType.ts, 23, 37))
// string type expressions
var ResultIsBoolean6 = !objA.a;
>ResultIsBoolean6 : boolean, Symbol(ResultIsBoolean6, Decl(logicalNotOperatorWithStringType.ts, 26, 3))
>!objA.a : boolean
>objA.a : string, Symbol(A.a, Decl(logicalNotOperatorWithStringType.ts, 6, 9))
>objA : A, Symbol(objA, Decl(logicalNotOperatorWithStringType.ts, 14, 3))
>a : string, Symbol(A.a, Decl(logicalNotOperatorWithStringType.ts, 6, 9))
var ResultIsBoolean7 = !M.n;
>ResultIsBoolean7 : boolean, Symbol(ResultIsBoolean7, Decl(logicalNotOperatorWithStringType.ts, 27, 3))
>!M.n : boolean
>M.n : string, Symbol(M.n, Decl(logicalNotOperatorWithStringType.ts, 11, 14))
>M : typeof M, Symbol(M, Decl(logicalNotOperatorWithStringType.ts, 9, 1))
>n : string, Symbol(M.n, Decl(logicalNotOperatorWithStringType.ts, 11, 14))
var ResultIsBoolean8 = !STRING1[0];
>ResultIsBoolean8 : boolean, Symbol(ResultIsBoolean8, Decl(logicalNotOperatorWithStringType.ts, 28, 3))
>!STRING1[0] : boolean
>STRING1[0] : string
>STRING1 : string[], Symbol(STRING1, Decl(logicalNotOperatorWithStringType.ts, 2, 3))
>0 : number
var ResultIsBoolean9 = !foo();
>ResultIsBoolean9 : boolean, Symbol(ResultIsBoolean9, Decl(logicalNotOperatorWithStringType.ts, 29, 3))
>!foo() : boolean
>foo() : string
>foo : () => string, Symbol(foo, Decl(logicalNotOperatorWithStringType.ts, 2, 36))
var ResultIsBoolean10 = !A.foo();
>ResultIsBoolean10 : boolean, Symbol(ResultIsBoolean10, Decl(logicalNotOperatorWithStringType.ts, 30, 3))
>!A.foo() : boolean
>A.foo() : string
>A.foo : () => string, Symbol(A.foo, Decl(logicalNotOperatorWithStringType.ts, 7, 21))
>A : typeof A, Symbol(A, Decl(logicalNotOperatorWithStringType.ts, 4, 40))
>foo : () => string, Symbol(A.foo, Decl(logicalNotOperatorWithStringType.ts, 7, 21))
var ResultIsBoolean11 = !(STRING + STRING);
>ResultIsBoolean11 : boolean, Symbol(ResultIsBoolean11, Decl(logicalNotOperatorWithStringType.ts, 31, 3))
>!(STRING + STRING) : boolean
>(STRING + STRING) : string
>STRING + STRING : string
>STRING : string, Symbol(STRING, Decl(logicalNotOperatorWithStringType.ts, 1, 3))
>STRING : string, Symbol(STRING, Decl(logicalNotOperatorWithStringType.ts, 1, 3))
var ResultIsBoolean12 = !STRING.charAt(0);
>ResultIsBoolean12 : boolean, Symbol(ResultIsBoolean12, Decl(logicalNotOperatorWithStringType.ts, 32, 3))
>!STRING.charAt(0) : boolean
>STRING.charAt(0) : string
>STRING.charAt : (pos: number) => string, Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>STRING : string, Symbol(STRING, Decl(logicalNotOperatorWithStringType.ts, 1, 3))
>charAt : (pos: number) => string, Symbol(String.charAt, Decl(lib.d.ts, 279, 23))
>0 : number
// multiple ! operator
var ResultIsBoolean13 = !!STRING;
>ResultIsBoolean13 : boolean, Symbol(ResultIsBoolean13, Decl(logicalNotOperatorWithStringType.ts, 35, 3))
>!!STRING : boolean
>!STRING : boolean
>STRING : string, Symbol(STRING, Decl(logicalNotOperatorWithStringType.ts, 1, 3))
var ResultIsBoolean14 = !!!(STRING + STRING);
>ResultIsBoolean14 : boolean, Symbol(ResultIsBoolean14, Decl(logicalNotOperatorWithStringType.ts, 36, 3))
>!!!(STRING + STRING) : boolean
>!!(STRING + STRING) : boolean
>!(STRING + STRING) : boolean
>(STRING + STRING) : string
>STRING + STRING : string
>STRING : string, Symbol(STRING, Decl(logicalNotOperatorWithStringType.ts, 1, 3))
>STRING : string, Symbol(STRING, Decl(logicalNotOperatorWithStringType.ts, 1, 3))
// miss assignment operators
!"";
>!"" : boolean
>"" : string
!STRING;
>!STRING : boolean
>STRING : string, Symbol(STRING, Decl(logicalNotOperatorWithStringType.ts, 1, 3))
!STRING1;
>!STRING1 : boolean
>STRING1 : string[], Symbol(STRING1, Decl(logicalNotOperatorWithStringType.ts, 2, 3))
!foo();
>!foo() : boolean
>foo() : string
>foo : () => string, Symbol(foo, Decl(logicalNotOperatorWithStringType.ts, 2, 36))
!objA.a,M.n;
>!objA.a,M.n : string
>!objA.a : boolean
>objA.a : string, Symbol(A.a, Decl(logicalNotOperatorWithStringType.ts, 6, 9))
>objA : A, Symbol(objA, Decl(logicalNotOperatorWithStringType.ts, 14, 3))
>a : string, Symbol(A.a, Decl(logicalNotOperatorWithStringType.ts, 6, 9))
>M.n : string, Symbol(M.n, Decl(logicalNotOperatorWithStringType.ts, 11, 14))
>M : typeof M, Symbol(M, Decl(logicalNotOperatorWithStringType.ts, 9, 1))
>n : string, Symbol(M.n, Decl(logicalNotOperatorWithStringType.ts, 11, 14))