File: plusOperatorWithStringType.symbols

package info (click to toggle)
node-typescript 2.1.5-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 203,952 kB
  • ctags: 52,987
  • sloc: sh: 11; makefile: 5
file content (113 lines) | stat: -rw-r--r-- 4,845 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
=== tests/cases/conformance/expressions/unaryOperators/plusOperator/plusOperatorWithStringType.ts ===
// + operator on string type
var STRING: string;
>STRING : Symbol(STRING, Decl(plusOperatorWithStringType.ts, 1, 3))

var STRING1: string[] = ["", "abc"];
>STRING1 : Symbol(STRING1, Decl(plusOperatorWithStringType.ts, 2, 3))

function foo(): string { return "abc"; }
>foo : Symbol(foo, Decl(plusOperatorWithStringType.ts, 2, 36))

class A {
>A : Symbol(A, Decl(plusOperatorWithStringType.ts, 4, 40))

    public a: string;
>a : Symbol(A.a, Decl(plusOperatorWithStringType.ts, 6, 9))

    static foo() { return ""; }
>foo : Symbol(A.foo, Decl(plusOperatorWithStringType.ts, 7, 21))
}
module M {
>M : Symbol(M, Decl(plusOperatorWithStringType.ts, 9, 1))

    export var n: string;
>n : Symbol(n, Decl(plusOperatorWithStringType.ts, 11, 14))
}

var objA = new A();
>objA : Symbol(objA, Decl(plusOperatorWithStringType.ts, 14, 3))
>A : Symbol(A, Decl(plusOperatorWithStringType.ts, 4, 40))

// string type var
var ResultIsNumber1 = +STRING;
>ResultIsNumber1 : Symbol(ResultIsNumber1, Decl(plusOperatorWithStringType.ts, 17, 3))
>STRING : Symbol(STRING, Decl(plusOperatorWithStringType.ts, 1, 3))

var ResultIsNumber2 = +STRING1;
>ResultIsNumber2 : Symbol(ResultIsNumber2, Decl(plusOperatorWithStringType.ts, 18, 3))
>STRING1 : Symbol(STRING1, Decl(plusOperatorWithStringType.ts, 2, 3))

// string type literal
var ResultIsNumber3 = +"";
>ResultIsNumber3 : Symbol(ResultIsNumber3, Decl(plusOperatorWithStringType.ts, 21, 3))

var ResultIsNumber4 = +{ x: "", y: "" };
>ResultIsNumber4 : Symbol(ResultIsNumber4, Decl(plusOperatorWithStringType.ts, 22, 3))
>x : Symbol(x, Decl(plusOperatorWithStringType.ts, 22, 24))
>y : Symbol(y, Decl(plusOperatorWithStringType.ts, 22, 31))

var ResultIsNumber5 = +{ x: "", y: (s: string) => { return s; } };
>ResultIsNumber5 : Symbol(ResultIsNumber5, Decl(plusOperatorWithStringType.ts, 23, 3))
>x : Symbol(x, Decl(plusOperatorWithStringType.ts, 23, 24))
>y : Symbol(y, Decl(plusOperatorWithStringType.ts, 23, 31))
>s : Symbol(s, Decl(plusOperatorWithStringType.ts, 23, 36))
>s : Symbol(s, Decl(plusOperatorWithStringType.ts, 23, 36))

// string type expressions
var ResultIsNumber6 = +objA.a;
>ResultIsNumber6 : Symbol(ResultIsNumber6, Decl(plusOperatorWithStringType.ts, 26, 3))
>objA.a : Symbol(A.a, Decl(plusOperatorWithStringType.ts, 6, 9))
>objA : Symbol(objA, Decl(plusOperatorWithStringType.ts, 14, 3))
>a : Symbol(A.a, Decl(plusOperatorWithStringType.ts, 6, 9))

var ResultIsNumber7 = +M.n;
>ResultIsNumber7 : Symbol(ResultIsNumber7, Decl(plusOperatorWithStringType.ts, 27, 3))
>M.n : Symbol(M.n, Decl(plusOperatorWithStringType.ts, 11, 14))
>M : Symbol(M, Decl(plusOperatorWithStringType.ts, 9, 1))
>n : Symbol(M.n, Decl(plusOperatorWithStringType.ts, 11, 14))

var ResultIsNumber8 = +STRING1[0];
>ResultIsNumber8 : Symbol(ResultIsNumber8, Decl(plusOperatorWithStringType.ts, 28, 3))
>STRING1 : Symbol(STRING1, Decl(plusOperatorWithStringType.ts, 2, 3))

var ResultIsNumber9 = +foo();
>ResultIsNumber9 : Symbol(ResultIsNumber9, Decl(plusOperatorWithStringType.ts, 29, 3))
>foo : Symbol(foo, Decl(plusOperatorWithStringType.ts, 2, 36))

var ResultIsNumber10 = +A.foo();
>ResultIsNumber10 : Symbol(ResultIsNumber10, Decl(plusOperatorWithStringType.ts, 30, 3))
>A.foo : Symbol(A.foo, Decl(plusOperatorWithStringType.ts, 7, 21))
>A : Symbol(A, Decl(plusOperatorWithStringType.ts, 4, 40))
>foo : Symbol(A.foo, Decl(plusOperatorWithStringType.ts, 7, 21))

var ResultIsNumber11 = +(STRING + STRING);
>ResultIsNumber11 : Symbol(ResultIsNumber11, Decl(plusOperatorWithStringType.ts, 31, 3))
>STRING : Symbol(STRING, Decl(plusOperatorWithStringType.ts, 1, 3))
>STRING : Symbol(STRING, Decl(plusOperatorWithStringType.ts, 1, 3))

var ResultIsNumber12 = +STRING.charAt(0);
>ResultIsNumber12 : Symbol(ResultIsNumber12, Decl(plusOperatorWithStringType.ts, 32, 3))
>STRING.charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))
>STRING : Symbol(STRING, Decl(plusOperatorWithStringType.ts, 1, 3))
>charAt : Symbol(String.charAt, Decl(lib.d.ts, --, --))

// miss assignment operators
+"";
+STRING;
>STRING : Symbol(STRING, Decl(plusOperatorWithStringType.ts, 1, 3))

+STRING1;
>STRING1 : Symbol(STRING1, Decl(plusOperatorWithStringType.ts, 2, 3))

+foo();
>foo : Symbol(foo, Decl(plusOperatorWithStringType.ts, 2, 36))

+objA.a,M.n;
>objA.a : Symbol(A.a, Decl(plusOperatorWithStringType.ts, 6, 9))
>objA : Symbol(objA, Decl(plusOperatorWithStringType.ts, 14, 3))
>a : Symbol(A.a, Decl(plusOperatorWithStringType.ts, 6, 9))
>M.n : Symbol(M.n, Decl(plusOperatorWithStringType.ts, 11, 14))
>M : Symbol(M, Decl(plusOperatorWithStringType.ts, 9, 1))
>n : Symbol(M.n, Decl(plusOperatorWithStringType.ts, 11, 14))