forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharraySpliceParamDescription.symbols
More file actions
155 lines (123 loc) · 8.57 KB
/
arraySpliceParamDescription.symbols
File metadata and controls
155 lines (123 loc) · 8.57 KB
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
//// [tests/cases/compiler/arraySpliceParamDescription.ts] ////
=== arraySpliceParamDescription.ts ===
// @target es5
export function isEmptyArr(l: { length: number }) {
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>l : Symbol(l, Decl(arraySpliceParamDescription.ts, 2, 27))
>length : Symbol(length, Decl(arraySpliceParamDescription.ts, 2, 31))
return l.length === 0
>l.length : Symbol(length, Decl(arraySpliceParamDescription.ts, 2, 31))
>l : Symbol(l, Decl(arraySpliceParamDescription.ts, 2, 27))
>length : Symbol(length, Decl(arraySpliceParamDescription.ts, 2, 31))
}
var arrA : string[]
>arrA : Symbol(arrA, Decl(arraySpliceParamDescription.ts, 6, 3))
arrA = ["a", "b", "c", "d", "e", "f", "g"]
>arrA : Symbol(arrA, Decl(arraySpliceParamDescription.ts, 6, 3))
// deleteCount param: undefined | NaN | 0 | -int; no elements removed
var undefSplice1 = arrA.splice(2, undefined) // OK
>undefSplice1 : Symbol(undefSplice1, Decl(arraySpliceParamDescription.ts, 10, 3))
>arrA.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>arrA : Symbol(arrA, Decl(arraySpliceParamDescription.ts, 6, 3))
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>undefined : Symbol(undefined)
var charSplice1 = arrA.splice(2, "a") // expect error
>charSplice1 : Symbol(charSplice1, Decl(arraySpliceParamDescription.ts, 11, 3))
>arrA.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>arrA : Symbol(arrA, Decl(arraySpliceParamDescription.ts, 6, 3))
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var naNSplice1 = arrA.splice(2, NaN) // OK
>naNSplice1 : Symbol(naNSplice1, Decl(arraySpliceParamDescription.ts, 12, 3))
>arrA.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>arrA : Symbol(arrA, Decl(arraySpliceParamDescription.ts, 6, 3))
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>NaN : Symbol(NaN, Decl(lib.es5.d.ts, --, --))
var zeroSplice1 = arrA.splice(2, 0) // OK
>zeroSplice1 : Symbol(zeroSplice1, Decl(arraySpliceParamDescription.ts, 13, 3))
>arrA.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>arrA : Symbol(arrA, Decl(arraySpliceParamDescription.ts, 6, 3))
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var negSplice1 = arrA.splice(2, -2) // OK and expect arrA = ["a", "b", "c", "d", "e", "f", "g"]
>negSplice1 : Symbol(negSplice1, Decl(arraySpliceParamDescription.ts, 14, 3))
>arrA.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>arrA : Symbol(arrA, Decl(arraySpliceParamDescription.ts, 6, 3))
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
// deleteCount param omitted; All elements after start param are removed
var omitSplice1 = arrA.splice(2,) // OK expect arrA = ["a", "b"]
>omitSplice1 : Symbol(omitSplice1, Decl(arraySpliceParamDescription.ts, 17, 3))
>arrA.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>arrA : Symbol(arrA, Decl(arraySpliceParamDescription.ts, 6, 3))
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
// testing the splice arrays are empty
isEmptyArr(undefSplice1) // OK and true
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>undefSplice1 : Symbol(undefSplice1, Decl(arraySpliceParamDescription.ts, 10, 3))
isEmptyArr(charSplice1) // OK and true
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>charSplice1 : Symbol(charSplice1, Decl(arraySpliceParamDescription.ts, 11, 3))
isEmptyArr(naNSplice1) // OK and true
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>naNSplice1 : Symbol(naNSplice1, Decl(arraySpliceParamDescription.ts, 12, 3))
isEmptyArr(zeroSplice1) // OK and true
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>zeroSplice1 : Symbol(zeroSplice1, Decl(arraySpliceParamDescription.ts, 13, 3))
isEmptyArr(negSplice1) // OK and true
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>negSplice1 : Symbol(negSplice1, Decl(arraySpliceParamDescription.ts, 14, 3))
isEmptyArr(omitSplice1) // OK and false. length of removed elements is 5
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>omitSplice1 : Symbol(omitSplice1, Decl(arraySpliceParamDescription.ts, 17, 3))
var arrB : string[]
>arrB : Symbol(arrB, Decl(arraySpliceParamDescription.ts, 27, 3))
arrB = ["a", "b", "c", "d", "e", "f", "g"]
>arrB : Symbol(arrB, Decl(arraySpliceParamDescription.ts, 27, 3))
var undefSplice2 = arrB.splice(2, undefined, "h", "i") // expect error and arrB = ["a", "b", "h", "i", "e", "f", "g"]
>undefSplice2 : Symbol(undefSplice2, Decl(arraySpliceParamDescription.ts, 30, 3))
>arrB.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>arrB : Symbol(arrB, Decl(arraySpliceParamDescription.ts, 27, 3))
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>undefined : Symbol(undefined)
var omitSplice2 = arrB.splice(2, , "j", "k") // expect error and arrB = ["a", "b", "j", "k", "e", "f", "g"]
>omitSplice2 : Symbol(omitSplice2, Decl(arraySpliceParamDescription.ts, 31, 3))
>arrB.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>arrB : Symbol(arrB, Decl(arraySpliceParamDescription.ts, 27, 3))
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var naNSplice2 = arrB.splice(2, NaN, "l", "m") // OK and arrB = ["a", "b", "l", "m", "e", "f", "g"]
>naNSplice2 : Symbol(naNSplice2, Decl(arraySpliceParamDescription.ts, 32, 3))
>arrB.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>arrB : Symbol(arrB, Decl(arraySpliceParamDescription.ts, 27, 3))
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>NaN : Symbol(NaN, Decl(lib.es5.d.ts, --, --))
var charSplice2 = arrB.splice(2, "a", "n", "o") // expect error and arrB = ["a", "b", "n", "o", "e", "f", "g"]
>charSplice2 : Symbol(charSplice2, Decl(arraySpliceParamDescription.ts, 33, 3))
>arrB.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>arrB : Symbol(arrB, Decl(arraySpliceParamDescription.ts, 27, 3))
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var zeroSplice2 = arrB.splice(2, 0, "p", "q") // OK and arrB = ["a", "b", "p", "q", "e", "f", "g"]
>zeroSplice2 : Symbol(zeroSplice2, Decl(arraySpliceParamDescription.ts, 34, 3))
>arrB.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>arrB : Symbol(arrB, Decl(arraySpliceParamDescription.ts, 27, 3))
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
var negSplice2 = arrB.splice(2, -2, "r", "s") // OK and arrB = ["a", "b", "r", "s", "e", "f", "g"]
>negSplice2 : Symbol(negSplice2, Decl(arraySpliceParamDescription.ts, 35, 3))
>arrB.splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
>arrB : Symbol(arrB, Decl(arraySpliceParamDescription.ts, 27, 3))
>splice : Symbol(Array.splice, Decl(lib.es5.d.ts, --, --), Decl(lib.es5.d.ts, --, --))
isEmptyArr(undefSplice2) // OK and true
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>undefSplice2 : Symbol(undefSplice2, Decl(arraySpliceParamDescription.ts, 30, 3))
isEmptyArr(omitSplice2) // OK and true
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>omitSplice2 : Symbol(omitSplice2, Decl(arraySpliceParamDescription.ts, 31, 3))
isEmptyArr(naNSplice2) // OK and true
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>naNSplice2 : Symbol(naNSplice2, Decl(arraySpliceParamDescription.ts, 32, 3))
isEmptyArr(charSplice2) // OK and true
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>charSplice2 : Symbol(charSplice2, Decl(arraySpliceParamDescription.ts, 33, 3))
isEmptyArr(zeroSplice2) // OK and true
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>zeroSplice2 : Symbol(zeroSplice2, Decl(arraySpliceParamDescription.ts, 34, 3))
isEmptyArr(negSplice2) // OK and true
>isEmptyArr : Symbol(isEmptyArr, Decl(arraySpliceParamDescription.ts, 0, 0))
>negSplice2 : Symbol(negSplice2, Decl(arraySpliceParamDescription.ts, 35, 3))