2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/conformance/expressions/unaryOperators/bitwiseNotOperator/bitwiseNotOperatorWithNumberType.ts ===
|
|
|
|
// ~ operator on number type
|
|
|
|
var NUMBER: number;
|
2015-04-13 22:54:22 +02:00
|
|
|
>NUMBER : number, Symbol(NUMBER,Decl(bitwiseNotOperatorWithNumberType.ts,1,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var NUMBER1: number[] = [1, 2];
|
2015-04-13 22:54:22 +02:00
|
|
|
>NUMBER1 : number[], Symbol(NUMBER1,Decl(bitwiseNotOperatorWithNumberType.ts,2,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>[1, 2] : number[]
|
2015-04-13 21:36:11 +02:00
|
|
|
>1 : number
|
|
|
|
>2 : number
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo(): number { return 1; }
|
2015-04-13 22:54:22 +02:00
|
|
|
>foo : () => number, Symbol(foo,Decl(bitwiseNotOperatorWithNumberType.ts,2,31))
|
2015-04-13 21:36:11 +02:00
|
|
|
>1 : number
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
class A {
|
2015-04-13 22:54:22 +02:00
|
|
|
>A : A, Symbol(A,Decl(bitwiseNotOperatorWithNumberType.ts,4,36))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
public a: number;
|
2015-04-13 22:54:22 +02:00
|
|
|
>a : number, Symbol(a,Decl(bitwiseNotOperatorWithNumberType.ts,6,9))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
static foo() { return 1; }
|
2015-04-13 22:54:22 +02:00
|
|
|
>foo : () => number, Symbol(A.foo,Decl(bitwiseNotOperatorWithNumberType.ts,7,21))
|
2015-04-13 21:36:11 +02:00
|
|
|
>1 : number
|
2014-08-15 23:33:16 +02:00
|
|
|
}
|
|
|
|
module M {
|
2015-04-13 22:54:22 +02:00
|
|
|
>M : typeof M, Symbol(M,Decl(bitwiseNotOperatorWithNumberType.ts,9,1))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
export var n: number;
|
2015-04-13 22:54:22 +02:00
|
|
|
>n : number, Symbol(n,Decl(bitwiseNotOperatorWithNumberType.ts,11,14))
|
2014-08-15 23:33:16 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
var objA = new A();
|
2015-04-13 22:54:22 +02:00
|
|
|
>objA : A, Symbol(objA,Decl(bitwiseNotOperatorWithNumberType.ts,14,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>new A() : A
|
2015-04-13 22:54:22 +02:00
|
|
|
>A : typeof A, Symbol(A,Decl(bitwiseNotOperatorWithNumberType.ts,4,36))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
// number type var
|
|
|
|
var ResultIsNumber1 = ~NUMBER;
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber1 : number, Symbol(ResultIsNumber1,Decl(bitwiseNotOperatorWithNumberType.ts,17,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~NUMBER : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>NUMBER : number, Symbol(NUMBER,Decl(bitwiseNotOperatorWithNumberType.ts,1,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var ResultIsNumber2 = ~NUMBER1;
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber2 : number, Symbol(ResultIsNumber2,Decl(bitwiseNotOperatorWithNumberType.ts,18,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~NUMBER1 : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>NUMBER1 : number[], Symbol(NUMBER1,Decl(bitwiseNotOperatorWithNumberType.ts,2,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
// number type literal
|
|
|
|
var ResultIsNumber3 = ~1;
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber3 : number, Symbol(ResultIsNumber3,Decl(bitwiseNotOperatorWithNumberType.ts,21,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~1 : number
|
2015-04-13 21:36:11 +02:00
|
|
|
>1 : number
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var ResultIsNumber4 = ~{ x: 1, y: 2};
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber4 : number, Symbol(ResultIsNumber4,Decl(bitwiseNotOperatorWithNumberType.ts,22,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~{ x: 1, y: 2} : number
|
|
|
|
>{ x: 1, y: 2} : { x: number; y: number; }
|
2015-04-13 22:54:22 +02:00
|
|
|
>x : number, Symbol(x,Decl(bitwiseNotOperatorWithNumberType.ts,22,24))
|
2015-04-13 21:36:11 +02:00
|
|
|
>1 : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>y : number, Symbol(y,Decl(bitwiseNotOperatorWithNumberType.ts,22,30))
|
2015-04-13 21:36:11 +02:00
|
|
|
>2 : number
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var ResultIsNumber5 = ~{ x: 1, y: (n: number) => { return n; } };
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber5 : number, Symbol(ResultIsNumber5,Decl(bitwiseNotOperatorWithNumberType.ts,23,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~{ x: 1, y: (n: number) => { return n; } } : number
|
|
|
|
>{ x: 1, y: (n: number) => { return n; } } : { x: number; y: (n: number) => number; }
|
2015-04-13 22:54:22 +02:00
|
|
|
>x : number, Symbol(x,Decl(bitwiseNotOperatorWithNumberType.ts,23,24))
|
2015-04-13 21:36:11 +02:00
|
|
|
>1 : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>y : (n: number) => number, Symbol(y,Decl(bitwiseNotOperatorWithNumberType.ts,23,30))
|
2014-08-15 23:33:16 +02:00
|
|
|
>(n: number) => { return n; } : (n: number) => number
|
2015-04-13 22:54:22 +02:00
|
|
|
>n : number, Symbol(n,Decl(bitwiseNotOperatorWithNumberType.ts,23,35))
|
|
|
|
>n : number, Symbol(n,Decl(bitwiseNotOperatorWithNumberType.ts,23,35))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
// number type expressions
|
|
|
|
var ResultIsNumber6 = ~objA.a;
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber6 : number, Symbol(ResultIsNumber6,Decl(bitwiseNotOperatorWithNumberType.ts,26,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~objA.a : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>objA.a : number, Symbol(A.a,Decl(bitwiseNotOperatorWithNumberType.ts,6,9))
|
|
|
|
>objA : A, Symbol(objA,Decl(bitwiseNotOperatorWithNumberType.ts,14,3))
|
|
|
|
>a : number, Symbol(A.a,Decl(bitwiseNotOperatorWithNumberType.ts,6,9))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var ResultIsNumber7 = ~M.n;
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber7 : number, Symbol(ResultIsNumber7,Decl(bitwiseNotOperatorWithNumberType.ts,27,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~M.n : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>M.n : number, Symbol(M.n,Decl(bitwiseNotOperatorWithNumberType.ts,11,14))
|
|
|
|
>M : typeof M, Symbol(M,Decl(bitwiseNotOperatorWithNumberType.ts,9,1))
|
|
|
|
>n : number, Symbol(M.n,Decl(bitwiseNotOperatorWithNumberType.ts,11,14))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var ResultIsNumber8 = ~NUMBER1[0];
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber8 : number, Symbol(ResultIsNumber8,Decl(bitwiseNotOperatorWithNumberType.ts,28,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~NUMBER1[0] : number
|
|
|
|
>NUMBER1[0] : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>NUMBER1 : number[], Symbol(NUMBER1,Decl(bitwiseNotOperatorWithNumberType.ts,2,3))
|
2015-04-13 21:36:11 +02:00
|
|
|
>0 : number
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var ResultIsNumber9 = ~foo();
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber9 : number, Symbol(ResultIsNumber9,Decl(bitwiseNotOperatorWithNumberType.ts,29,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~foo() : number
|
|
|
|
>foo() : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>foo : () => number, Symbol(foo,Decl(bitwiseNotOperatorWithNumberType.ts,2,31))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var ResultIsNumber10 = ~A.foo();
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber10 : number, Symbol(ResultIsNumber10,Decl(bitwiseNotOperatorWithNumberType.ts,30,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~A.foo() : number
|
|
|
|
>A.foo() : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>A.foo : () => number, Symbol(A.foo,Decl(bitwiseNotOperatorWithNumberType.ts,7,21))
|
|
|
|
>A : typeof A, Symbol(A,Decl(bitwiseNotOperatorWithNumberType.ts,4,36))
|
|
|
|
>foo : () => number, Symbol(A.foo,Decl(bitwiseNotOperatorWithNumberType.ts,7,21))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var ResultIsNumber11 = ~(NUMBER + NUMBER);
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber11 : number, Symbol(ResultIsNumber11,Decl(bitwiseNotOperatorWithNumberType.ts,31,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~(NUMBER + NUMBER) : number
|
|
|
|
>(NUMBER + NUMBER) : number
|
|
|
|
>NUMBER + NUMBER : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>NUMBER : number, Symbol(NUMBER,Decl(bitwiseNotOperatorWithNumberType.ts,1,3))
|
|
|
|
>NUMBER : number, Symbol(NUMBER,Decl(bitwiseNotOperatorWithNumberType.ts,1,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
// multiple ~ operators
|
|
|
|
var ResultIsNumber12 = ~~NUMBER;
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber12 : number, Symbol(ResultIsNumber12,Decl(bitwiseNotOperatorWithNumberType.ts,34,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~~NUMBER : number
|
|
|
|
>~NUMBER : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>NUMBER : number, Symbol(NUMBER,Decl(bitwiseNotOperatorWithNumberType.ts,1,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var ResultIsNumber13 = ~~~(NUMBER + NUMBER);
|
2015-04-13 22:54:22 +02:00
|
|
|
>ResultIsNumber13 : number, Symbol(ResultIsNumber13,Decl(bitwiseNotOperatorWithNumberType.ts,35,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
>~~~(NUMBER + NUMBER) : number
|
|
|
|
>~~(NUMBER + NUMBER) : number
|
|
|
|
>~(NUMBER + NUMBER) : number
|
|
|
|
>(NUMBER + NUMBER) : number
|
|
|
|
>NUMBER + NUMBER : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>NUMBER : number, Symbol(NUMBER,Decl(bitwiseNotOperatorWithNumberType.ts,1,3))
|
|
|
|
>NUMBER : number, Symbol(NUMBER,Decl(bitwiseNotOperatorWithNumberType.ts,1,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
// miss assignment operators
|
|
|
|
~NUMBER;
|
|
|
|
>~NUMBER : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>NUMBER : number, Symbol(NUMBER,Decl(bitwiseNotOperatorWithNumberType.ts,1,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
~NUMBER1;
|
|
|
|
>~NUMBER1 : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>NUMBER1 : number[], Symbol(NUMBER1,Decl(bitwiseNotOperatorWithNumberType.ts,2,3))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
~foo();
|
|
|
|
>~foo() : number
|
|
|
|
>foo() : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>foo : () => number, Symbol(foo,Decl(bitwiseNotOperatorWithNumberType.ts,2,31))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
~objA.a;
|
|
|
|
>~objA.a : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>objA.a : number, Symbol(A.a,Decl(bitwiseNotOperatorWithNumberType.ts,6,9))
|
|
|
|
>objA : A, Symbol(objA,Decl(bitwiseNotOperatorWithNumberType.ts,14,3))
|
|
|
|
>a : number, Symbol(A.a,Decl(bitwiseNotOperatorWithNumberType.ts,6,9))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
~M.n;
|
|
|
|
>~M.n : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>M.n : number, Symbol(M.n,Decl(bitwiseNotOperatorWithNumberType.ts,11,14))
|
|
|
|
>M : typeof M, Symbol(M,Decl(bitwiseNotOperatorWithNumberType.ts,9,1))
|
|
|
|
>n : number, Symbol(M.n,Decl(bitwiseNotOperatorWithNumberType.ts,11,14))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
~objA.a, M.n;
|
|
|
|
>~objA.a, M.n : number
|
|
|
|
>~objA.a : number
|
2015-04-13 22:54:22 +02:00
|
|
|
>objA.a : number, Symbol(A.a,Decl(bitwiseNotOperatorWithNumberType.ts,6,9))
|
|
|
|
>objA : A, Symbol(objA,Decl(bitwiseNotOperatorWithNumberType.ts,14,3))
|
|
|
|
>a : number, Symbol(A.a,Decl(bitwiseNotOperatorWithNumberType.ts,6,9))
|
|
|
|
>M.n : number, Symbol(M.n,Decl(bitwiseNotOperatorWithNumberType.ts,11,14))
|
|
|
|
>M : typeof M, Symbol(M,Decl(bitwiseNotOperatorWithNumberType.ts,9,1))
|
|
|
|
>n : number, Symbol(M.n,Decl(bitwiseNotOperatorWithNumberType.ts,11,14))
|
2014-08-15 23:33:16 +02:00
|
|
|
|