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