168 lines
7 KiB
Text
168 lines
7 KiB
Text
=== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithStringType.ts ===
|
|
// ~ operator on string type
|
|
var STRING: string;
|
|
>STRING : string, Symbol(STRING,Decl(bitwiseNotOperatorWithStringType.ts,1,3))
|
|
|
|
var STRING1: string[] = ["", "abc"];
|
|
>STRING1 : string[], Symbol(STRING1,Decl(bitwiseNotOperatorWithStringType.ts,2,3))
|
|
>["", "abc"] : string[]
|
|
>"" : string
|
|
>"abc" : string
|
|
|
|
function foo(): string { return "abc"; }
|
|
>foo : () => string, Symbol(foo,Decl(bitwiseNotOperatorWithStringType.ts,2,36))
|
|
>"abc" : string
|
|
|
|
class A {
|
|
>A : A, Symbol(A,Decl(bitwiseNotOperatorWithStringType.ts,4,40))
|
|
|
|
public a: string;
|
|
>a : string, Symbol(a,Decl(bitwiseNotOperatorWithStringType.ts,6,9))
|
|
|
|
static foo() { return ""; }
|
|
>foo : () => string, Symbol(A.foo,Decl(bitwiseNotOperatorWithStringType.ts,7,21))
|
|
>"" : string
|
|
}
|
|
module M {
|
|
>M : typeof M, Symbol(M,Decl(bitwiseNotOperatorWithStringType.ts,9,1))
|
|
|
|
export var n: string;
|
|
>n : string, Symbol(n,Decl(bitwiseNotOperatorWithStringType.ts,11,14))
|
|
}
|
|
|
|
var objA = new A();
|
|
>objA : A, Symbol(objA,Decl(bitwiseNotOperatorWithStringType.ts,14,3))
|
|
>new A() : A
|
|
>A : typeof A, Symbol(A,Decl(bitwiseNotOperatorWithStringType.ts,4,40))
|
|
|
|
// string type var
|
|
var ResultIsNumber1 = ~STRING;
|
|
>ResultIsNumber1 : number, Symbol(ResultIsNumber1,Decl(bitwiseNotOperatorWithStringType.ts,17,3))
|
|
>~STRING : number
|
|
>STRING : string, Symbol(STRING,Decl(bitwiseNotOperatorWithStringType.ts,1,3))
|
|
|
|
var ResultIsNumber2 = ~STRING1;
|
|
>ResultIsNumber2 : number, Symbol(ResultIsNumber2,Decl(bitwiseNotOperatorWithStringType.ts,18,3))
|
|
>~STRING1 : number
|
|
>STRING1 : string[], Symbol(STRING1,Decl(bitwiseNotOperatorWithStringType.ts,2,3))
|
|
|
|
// string type literal
|
|
var ResultIsNumber3 = ~"";
|
|
>ResultIsNumber3 : number, Symbol(ResultIsNumber3,Decl(bitwiseNotOperatorWithStringType.ts,21,3))
|
|
>~"" : number
|
|
>"" : string
|
|
|
|
var ResultIsNumber4 = ~{ x: "", y: "" };
|
|
>ResultIsNumber4 : number, Symbol(ResultIsNumber4,Decl(bitwiseNotOperatorWithStringType.ts,22,3))
|
|
>~{ x: "", y: "" } : number
|
|
>{ x: "", y: "" } : { x: string; y: string; }
|
|
>x : string, Symbol(x,Decl(bitwiseNotOperatorWithStringType.ts,22,24))
|
|
>"" : string
|
|
>y : string, Symbol(y,Decl(bitwiseNotOperatorWithStringType.ts,22,31))
|
|
>"" : string
|
|
|
|
var ResultIsNumber5 = ~{ x: "", y: (s: string) => { return s; } };
|
|
>ResultIsNumber5 : number, Symbol(ResultIsNumber5,Decl(bitwiseNotOperatorWithStringType.ts,23,3))
|
|
>~{ x: "", y: (s: string) => { return s; } } : number
|
|
>{ x: "", y: (s: string) => { return s; } } : { x: string; y: (s: string) => string; }
|
|
>x : string, Symbol(x,Decl(bitwiseNotOperatorWithStringType.ts,23,24))
|
|
>"" : string
|
|
>y : (s: string) => string, Symbol(y,Decl(bitwiseNotOperatorWithStringType.ts,23,31))
|
|
>(s: string) => { return s; } : (s: string) => string
|
|
>s : string, Symbol(s,Decl(bitwiseNotOperatorWithStringType.ts,23,36))
|
|
>s : string, Symbol(s,Decl(bitwiseNotOperatorWithStringType.ts,23,36))
|
|
|
|
// string type expressions
|
|
var ResultIsNumber6 = ~objA.a;
|
|
>ResultIsNumber6 : number, Symbol(ResultIsNumber6,Decl(bitwiseNotOperatorWithStringType.ts,26,3))
|
|
>~objA.a : number
|
|
>objA.a : string, Symbol(A.a,Decl(bitwiseNotOperatorWithStringType.ts,6,9))
|
|
>objA : A, Symbol(objA,Decl(bitwiseNotOperatorWithStringType.ts,14,3))
|
|
>a : string, Symbol(A.a,Decl(bitwiseNotOperatorWithStringType.ts,6,9))
|
|
|
|
var ResultIsNumber7 = ~M.n;
|
|
>ResultIsNumber7 : number, Symbol(ResultIsNumber7,Decl(bitwiseNotOperatorWithStringType.ts,27,3))
|
|
>~M.n : number
|
|
>M.n : string, Symbol(M.n,Decl(bitwiseNotOperatorWithStringType.ts,11,14))
|
|
>M : typeof M, Symbol(M,Decl(bitwiseNotOperatorWithStringType.ts,9,1))
|
|
>n : string, Symbol(M.n,Decl(bitwiseNotOperatorWithStringType.ts,11,14))
|
|
|
|
var ResultIsNumber8 = ~STRING1[0];
|
|
>ResultIsNumber8 : number, Symbol(ResultIsNumber8,Decl(bitwiseNotOperatorWithStringType.ts,28,3))
|
|
>~STRING1[0] : number
|
|
>STRING1[0] : string
|
|
>STRING1 : string[], Symbol(STRING1,Decl(bitwiseNotOperatorWithStringType.ts,2,3))
|
|
>0 : number
|
|
|
|
var ResultIsNumber9 = ~foo();
|
|
>ResultIsNumber9 : number, Symbol(ResultIsNumber9,Decl(bitwiseNotOperatorWithStringType.ts,29,3))
|
|
>~foo() : number
|
|
>foo() : string
|
|
>foo : () => string, Symbol(foo,Decl(bitwiseNotOperatorWithStringType.ts,2,36))
|
|
|
|
var ResultIsNumber10 = ~A.foo();
|
|
>ResultIsNumber10 : number, Symbol(ResultIsNumber10,Decl(bitwiseNotOperatorWithStringType.ts,30,3))
|
|
>~A.foo() : number
|
|
>A.foo() : string
|
|
>A.foo : () => string, Symbol(A.foo,Decl(bitwiseNotOperatorWithStringType.ts,7,21))
|
|
>A : typeof A, Symbol(A,Decl(bitwiseNotOperatorWithStringType.ts,4,40))
|
|
>foo : () => string, Symbol(A.foo,Decl(bitwiseNotOperatorWithStringType.ts,7,21))
|
|
|
|
var ResultIsNumber11 = ~(STRING + STRING);
|
|
>ResultIsNumber11 : number, Symbol(ResultIsNumber11,Decl(bitwiseNotOperatorWithStringType.ts,31,3))
|
|
>~(STRING + STRING) : number
|
|
>(STRING + STRING) : string
|
|
>STRING + STRING : string
|
|
>STRING : string, Symbol(STRING,Decl(bitwiseNotOperatorWithStringType.ts,1,3))
|
|
>STRING : string, Symbol(STRING,Decl(bitwiseNotOperatorWithStringType.ts,1,3))
|
|
|
|
var ResultIsNumber12 = ~STRING.charAt(0);
|
|
>ResultIsNumber12 : number, Symbol(ResultIsNumber12,Decl(bitwiseNotOperatorWithStringType.ts,32,3))
|
|
>~STRING.charAt(0) : number
|
|
>STRING.charAt(0) : string
|
|
>STRING.charAt : (pos: number) => string, Symbol(String.charAt,Decl(lib.d.ts,279,23))
|
|
>STRING : string, Symbol(STRING,Decl(bitwiseNotOperatorWithStringType.ts,1,3))
|
|
>charAt : (pos: number) => string, Symbol(String.charAt,Decl(lib.d.ts,279,23))
|
|
>0 : number
|
|
|
|
// multiple ~ operators
|
|
var ResultIsNumber13 = ~~STRING;
|
|
>ResultIsNumber13 : number, Symbol(ResultIsNumber13,Decl(bitwiseNotOperatorWithStringType.ts,35,3))
|
|
>~~STRING : number
|
|
>~STRING : number
|
|
>STRING : string, Symbol(STRING,Decl(bitwiseNotOperatorWithStringType.ts,1,3))
|
|
|
|
var ResultIsNumber14 = ~~~(STRING + STRING);
|
|
>ResultIsNumber14 : number, Symbol(ResultIsNumber14,Decl(bitwiseNotOperatorWithStringType.ts,36,3))
|
|
>~~~(STRING + STRING) : number
|
|
>~~(STRING + STRING) : number
|
|
>~(STRING + STRING) : number
|
|
>(STRING + STRING) : string
|
|
>STRING + STRING : string
|
|
>STRING : string, Symbol(STRING,Decl(bitwiseNotOperatorWithStringType.ts,1,3))
|
|
>STRING : string, Symbol(STRING,Decl(bitwiseNotOperatorWithStringType.ts,1,3))
|
|
|
|
//miss assignment operators
|
|
~STRING;
|
|
>~STRING : number
|
|
>STRING : string, Symbol(STRING,Decl(bitwiseNotOperatorWithStringType.ts,1,3))
|
|
|
|
~STRING1;
|
|
>~STRING1 : number
|
|
>STRING1 : string[], Symbol(STRING1,Decl(bitwiseNotOperatorWithStringType.ts,2,3))
|
|
|
|
~foo();
|
|
>~foo() : number
|
|
>foo() : string
|
|
>foo : () => string, Symbol(foo,Decl(bitwiseNotOperatorWithStringType.ts,2,36))
|
|
|
|
~objA.a,M.n;
|
|
>~objA.a,M.n : string
|
|
>~objA.a : number
|
|
>objA.a : string, Symbol(A.a,Decl(bitwiseNotOperatorWithStringType.ts,6,9))
|
|
>objA : A, Symbol(objA,Decl(bitwiseNotOperatorWithStringType.ts,14,3))
|
|
>a : string, Symbol(A.a,Decl(bitwiseNotOperatorWithStringType.ts,6,9))
|
|
>M.n : string, Symbol(M.n,Decl(bitwiseNotOperatorWithStringType.ts,11,14))
|
|
>M : typeof M, Symbol(M,Decl(bitwiseNotOperatorWithStringType.ts,9,1))
|
|
>n : string, Symbol(M.n,Decl(bitwiseNotOperatorWithStringType.ts,11,14))
|
|
|