File: typeInferenceWithTupleType.symbols

package info (click to toggle)
node-typescript 4.9.5%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 533,908 kB
  • sloc: javascript: 2,018,330; makefile: 7; sh: 1
file content (132 lines) | stat: -rw-r--r-- 6,335 bytes parent folder | download | duplicates (4)
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
=== tests/cases/conformance/types/tuple/typeInferenceWithTupleType.ts ===
function combine<T, U>(x: T, y: U): [T, U] {
>combine : Symbol(combine, Decl(typeInferenceWithTupleType.ts, 0, 0))
>T : Symbol(T, Decl(typeInferenceWithTupleType.ts, 0, 17))
>U : Symbol(U, Decl(typeInferenceWithTupleType.ts, 0, 19))
>x : Symbol(x, Decl(typeInferenceWithTupleType.ts, 0, 23))
>T : Symbol(T, Decl(typeInferenceWithTupleType.ts, 0, 17))
>y : Symbol(y, Decl(typeInferenceWithTupleType.ts, 0, 28))
>U : Symbol(U, Decl(typeInferenceWithTupleType.ts, 0, 19))
>T : Symbol(T, Decl(typeInferenceWithTupleType.ts, 0, 17))
>U : Symbol(U, Decl(typeInferenceWithTupleType.ts, 0, 19))

    return [x, y];
>x : Symbol(x, Decl(typeInferenceWithTupleType.ts, 0, 23))
>y : Symbol(y, Decl(typeInferenceWithTupleType.ts, 0, 28))
}

var combineResult = combine("string", 10);
>combineResult : Symbol(combineResult, Decl(typeInferenceWithTupleType.ts, 4, 3))
>combine : Symbol(combine, Decl(typeInferenceWithTupleType.ts, 0, 0))

var combineEle1 = combineResult[0]; // string
>combineEle1 : Symbol(combineEle1, Decl(typeInferenceWithTupleType.ts, 5, 3))
>combineResult : Symbol(combineResult, Decl(typeInferenceWithTupleType.ts, 4, 3))
>0 : Symbol(0)

var combineEle2 = combineResult[1]; // number
>combineEle2 : Symbol(combineEle2, Decl(typeInferenceWithTupleType.ts, 6, 3))
>combineResult : Symbol(combineResult, Decl(typeInferenceWithTupleType.ts, 4, 3))
>1 : Symbol(1)

function zip<T, U>(array1: T[], array2: U[]): [[T, U]] {
>zip : Symbol(zip, Decl(typeInferenceWithTupleType.ts, 6, 35))
>T : Symbol(T, Decl(typeInferenceWithTupleType.ts, 8, 13))
>U : Symbol(U, Decl(typeInferenceWithTupleType.ts, 8, 15))
>array1 : Symbol(array1, Decl(typeInferenceWithTupleType.ts, 8, 19))
>T : Symbol(T, Decl(typeInferenceWithTupleType.ts, 8, 13))
>array2 : Symbol(array2, Decl(typeInferenceWithTupleType.ts, 8, 31))
>U : Symbol(U, Decl(typeInferenceWithTupleType.ts, 8, 15))
>T : Symbol(T, Decl(typeInferenceWithTupleType.ts, 8, 13))
>U : Symbol(U, Decl(typeInferenceWithTupleType.ts, 8, 15))

    if (array1.length != array2.length) {
>array1.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
>array1 : Symbol(array1, Decl(typeInferenceWithTupleType.ts, 8, 19))
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
>array2.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
>array2 : Symbol(array2, Decl(typeInferenceWithTupleType.ts, 8, 31))
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))

        return [[undefined, undefined]];
>undefined : Symbol(undefined)
>undefined : Symbol(undefined)
    }
    var length = array1.length;
>length : Symbol(length, Decl(typeInferenceWithTupleType.ts, 12, 7))
>array1.length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))
>array1 : Symbol(array1, Decl(typeInferenceWithTupleType.ts, 8, 19))
>length : Symbol(Array.length, Decl(lib.es5.d.ts, --, --))

    var zipResult: [[T, U]];
>zipResult : Symbol(zipResult, Decl(typeInferenceWithTupleType.ts, 13, 7))
>T : Symbol(T, Decl(typeInferenceWithTupleType.ts, 8, 13))
>U : Symbol(U, Decl(typeInferenceWithTupleType.ts, 8, 15))

    for (var i = 0; i < length; ++i) {
>i : Symbol(i, Decl(typeInferenceWithTupleType.ts, 14, 12))
>i : Symbol(i, Decl(typeInferenceWithTupleType.ts, 14, 12))
>length : Symbol(length, Decl(typeInferenceWithTupleType.ts, 12, 7))
>i : Symbol(i, Decl(typeInferenceWithTupleType.ts, 14, 12))

        zipResult.push([array1[i], array2[i]]);
>zipResult.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>zipResult : Symbol(zipResult, Decl(typeInferenceWithTupleType.ts, 13, 7))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>array1 : Symbol(array1, Decl(typeInferenceWithTupleType.ts, 8, 19))
>i : Symbol(i, Decl(typeInferenceWithTupleType.ts, 14, 12))
>array2 : Symbol(array2, Decl(typeInferenceWithTupleType.ts, 8, 31))
>i : Symbol(i, Decl(typeInferenceWithTupleType.ts, 14, 12))
    }
    return zipResult;
>zipResult : Symbol(zipResult, Decl(typeInferenceWithTupleType.ts, 13, 7))
}

var zipResult = zip(["foo", "bar"], [5, 6]);
>zipResult : Symbol(zipResult, Decl(typeInferenceWithTupleType.ts, 20, 3))
>zip : Symbol(zip, Decl(typeInferenceWithTupleType.ts, 6, 35))

var zipResultEle = zipResult[0]; // [string, number]
>zipResultEle : Symbol(zipResultEle, Decl(typeInferenceWithTupleType.ts, 21, 3))
>zipResult : Symbol(zipResult, Decl(typeInferenceWithTupleType.ts, 20, 3))
>0 : Symbol(0)

var zipResultEleEle = zipResult[0][0]; // string
>zipResultEleEle : Symbol(zipResultEleEle, Decl(typeInferenceWithTupleType.ts, 22, 3))
>zipResult : Symbol(zipResult, Decl(typeInferenceWithTupleType.ts, 20, 3))
>0 : Symbol(0)
>0 : Symbol(0)

// #33559 and #33752

declare function f1<T1, T2>(values: [T1[], T2[]]): T1;
>f1 : Symbol(f1, Decl(typeInferenceWithTupleType.ts, 22, 38))
>T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 26, 20))
>T2 : Symbol(T2, Decl(typeInferenceWithTupleType.ts, 26, 23))
>values : Symbol(values, Decl(typeInferenceWithTupleType.ts, 26, 28))
>T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 26, 20))
>T2 : Symbol(T2, Decl(typeInferenceWithTupleType.ts, 26, 23))
>T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 26, 20))

declare function f2<T1, T2>(values: readonly [T1[], T2[]]): T1;
>f2 : Symbol(f2, Decl(typeInferenceWithTupleType.ts, 26, 54))
>T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 27, 20))
>T2 : Symbol(T2, Decl(typeInferenceWithTupleType.ts, 27, 23))
>values : Symbol(values, Decl(typeInferenceWithTupleType.ts, 27, 28))
>T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 27, 20))
>T2 : Symbol(T2, Decl(typeInferenceWithTupleType.ts, 27, 23))
>T1 : Symbol(T1, Decl(typeInferenceWithTupleType.ts, 27, 20))

let expected: "a";
>expected : Symbol(expected, Decl(typeInferenceWithTupleType.ts, 29, 3))

expected = f1(undefined as ["a"[], "b"[]]);
>expected : Symbol(expected, Decl(typeInferenceWithTupleType.ts, 29, 3))
>f1 : Symbol(f1, Decl(typeInferenceWithTupleType.ts, 22, 38))
>undefined : Symbol(undefined)

expected = f2(undefined as ["a"[], "b"[]]);
>expected : Symbol(expected, Decl(typeInferenceWithTupleType.ts, 29, 3))
>f2 : Symbol(f2, Decl(typeInferenceWithTupleType.ts, 26, 54))
>undefined : Symbol(undefined)