117 lines
4.9 KiB
Text
117 lines
4.9 KiB
Text
=== tests/cases/conformance/expressions/unaryOperators/negateOperator/negateOperatorWithNumberType.ts ===
|
|
// - operator on number type
|
|
var NUMBER: number;
|
|
>NUMBER : Symbol(NUMBER, Decl(negateOperatorWithNumberType.ts, 1, 3))
|
|
|
|
var NUMBER1: number[] = [1, 2];
|
|
>NUMBER1 : Symbol(NUMBER1, Decl(negateOperatorWithNumberType.ts, 2, 3))
|
|
|
|
function foo(): number { return 1; }
|
|
>foo : Symbol(foo, Decl(negateOperatorWithNumberType.ts, 2, 31))
|
|
|
|
class A {
|
|
>A : Symbol(A, Decl(negateOperatorWithNumberType.ts, 4, 36))
|
|
|
|
public a: number;
|
|
>a : Symbol(a, Decl(negateOperatorWithNumberType.ts, 6, 9))
|
|
|
|
static foo() { return 1; }
|
|
>foo : Symbol(A.foo, Decl(negateOperatorWithNumberType.ts, 7, 21))
|
|
}
|
|
module M {
|
|
>M : Symbol(M, Decl(negateOperatorWithNumberType.ts, 9, 1))
|
|
|
|
export var n: number;
|
|
>n : Symbol(n, Decl(negateOperatorWithNumberType.ts, 11, 14))
|
|
}
|
|
|
|
var objA = new A();
|
|
>objA : Symbol(objA, Decl(negateOperatorWithNumberType.ts, 14, 3))
|
|
>A : Symbol(A, Decl(negateOperatorWithNumberType.ts, 4, 36))
|
|
|
|
// number type var
|
|
var ResultIsNumber1 = -NUMBER;
|
|
>ResultIsNumber1 : Symbol(ResultIsNumber1, Decl(negateOperatorWithNumberType.ts, 17, 3))
|
|
>NUMBER : Symbol(NUMBER, Decl(negateOperatorWithNumberType.ts, 1, 3))
|
|
|
|
var ResultIsNumber2 = -NUMBER1;
|
|
>ResultIsNumber2 : Symbol(ResultIsNumber2, Decl(negateOperatorWithNumberType.ts, 18, 3))
|
|
>NUMBER1 : Symbol(NUMBER1, Decl(negateOperatorWithNumberType.ts, 2, 3))
|
|
|
|
// number type literal
|
|
var ResultIsNumber3 = -1;
|
|
>ResultIsNumber3 : Symbol(ResultIsNumber3, Decl(negateOperatorWithNumberType.ts, 21, 3))
|
|
|
|
var ResultIsNumber4 = -{ x: 1, y: 2};
|
|
>ResultIsNumber4 : Symbol(ResultIsNumber4, Decl(negateOperatorWithNumberType.ts, 22, 3))
|
|
>x : Symbol(x, Decl(negateOperatorWithNumberType.ts, 22, 24))
|
|
>y : Symbol(y, Decl(negateOperatorWithNumberType.ts, 22, 30))
|
|
|
|
var ResultIsNumber5 = -{ x: 1, y: (n: number) => { return n; } };
|
|
>ResultIsNumber5 : Symbol(ResultIsNumber5, Decl(negateOperatorWithNumberType.ts, 23, 3))
|
|
>x : Symbol(x, Decl(negateOperatorWithNumberType.ts, 23, 24))
|
|
>y : Symbol(y, Decl(negateOperatorWithNumberType.ts, 23, 30))
|
|
>n : Symbol(n, Decl(negateOperatorWithNumberType.ts, 23, 35))
|
|
>n : Symbol(n, Decl(negateOperatorWithNumberType.ts, 23, 35))
|
|
|
|
// number type expressions
|
|
var ResultIsNumber6 = -objA.a;
|
|
>ResultIsNumber6 : Symbol(ResultIsNumber6, Decl(negateOperatorWithNumberType.ts, 26, 3))
|
|
>objA.a : Symbol(A.a, Decl(negateOperatorWithNumberType.ts, 6, 9))
|
|
>objA : Symbol(objA, Decl(negateOperatorWithNumberType.ts, 14, 3))
|
|
>a : Symbol(A.a, Decl(negateOperatorWithNumberType.ts, 6, 9))
|
|
|
|
var ResultIsNumber7 = -M.n;
|
|
>ResultIsNumber7 : Symbol(ResultIsNumber7, Decl(negateOperatorWithNumberType.ts, 27, 3))
|
|
>M.n : Symbol(M.n, Decl(negateOperatorWithNumberType.ts, 11, 14))
|
|
>M : Symbol(M, Decl(negateOperatorWithNumberType.ts, 9, 1))
|
|
>n : Symbol(M.n, Decl(negateOperatorWithNumberType.ts, 11, 14))
|
|
|
|
var ResultIsNumber8 = -NUMBER1[0];
|
|
>ResultIsNumber8 : Symbol(ResultIsNumber8, Decl(negateOperatorWithNumberType.ts, 28, 3))
|
|
>NUMBER1 : Symbol(NUMBER1, Decl(negateOperatorWithNumberType.ts, 2, 3))
|
|
|
|
var ResultIsNumber9 = -foo();
|
|
>ResultIsNumber9 : Symbol(ResultIsNumber9, Decl(negateOperatorWithNumberType.ts, 29, 3))
|
|
>foo : Symbol(foo, Decl(negateOperatorWithNumberType.ts, 2, 31))
|
|
|
|
var ResultIsNumber10 = -A.foo();
|
|
>ResultIsNumber10 : Symbol(ResultIsNumber10, Decl(negateOperatorWithNumberType.ts, 30, 3))
|
|
>A.foo : Symbol(A.foo, Decl(negateOperatorWithNumberType.ts, 7, 21))
|
|
>A : Symbol(A, Decl(negateOperatorWithNumberType.ts, 4, 36))
|
|
>foo : Symbol(A.foo, Decl(negateOperatorWithNumberType.ts, 7, 21))
|
|
|
|
var ResultIsNumber11 = -(NUMBER - NUMBER);
|
|
>ResultIsNumber11 : Symbol(ResultIsNumber11, Decl(negateOperatorWithNumberType.ts, 31, 3))
|
|
>NUMBER : Symbol(NUMBER, Decl(negateOperatorWithNumberType.ts, 1, 3))
|
|
>NUMBER : Symbol(NUMBER, Decl(negateOperatorWithNumberType.ts, 1, 3))
|
|
|
|
// miss assignment operators
|
|
-1;
|
|
-NUMBER;
|
|
>NUMBER : Symbol(NUMBER, Decl(negateOperatorWithNumberType.ts, 1, 3))
|
|
|
|
-NUMBER1;
|
|
>NUMBER1 : Symbol(NUMBER1, Decl(negateOperatorWithNumberType.ts, 2, 3))
|
|
|
|
-foo();
|
|
>foo : Symbol(foo, Decl(negateOperatorWithNumberType.ts, 2, 31))
|
|
|
|
-objA.a;
|
|
>objA.a : Symbol(A.a, Decl(negateOperatorWithNumberType.ts, 6, 9))
|
|
>objA : Symbol(objA, Decl(negateOperatorWithNumberType.ts, 14, 3))
|
|
>a : Symbol(A.a, Decl(negateOperatorWithNumberType.ts, 6, 9))
|
|
|
|
-M.n;
|
|
>M.n : Symbol(M.n, Decl(negateOperatorWithNumberType.ts, 11, 14))
|
|
>M : Symbol(M, Decl(negateOperatorWithNumberType.ts, 9, 1))
|
|
>n : Symbol(M.n, Decl(negateOperatorWithNumberType.ts, 11, 14))
|
|
|
|
-objA.a, M.n;
|
|
>objA.a : Symbol(A.a, Decl(negateOperatorWithNumberType.ts, 6, 9))
|
|
>objA : Symbol(objA, Decl(negateOperatorWithNumberType.ts, 14, 3))
|
|
>a : Symbol(A.a, Decl(negateOperatorWithNumberType.ts, 6, 9))
|
|
>M.n : Symbol(M.n, Decl(negateOperatorWithNumberType.ts, 11, 14))
|
|
>M : Symbol(M, Decl(negateOperatorWithNumberType.ts, 9, 1))
|
|
>n : Symbol(M.n, Decl(negateOperatorWithNumberType.ts, 11, 14))
|
|
|