101 lines
4.6 KiB
Plaintext
101 lines
4.6 KiB
Plaintext
=== 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.d.ts, 1007, 20))
|
|
>array1 : Symbol(array1, Decl(typeInferenceWithTupleType.ts, 8, 19))
|
|
>length : Symbol(Array.length, Decl(lib.d.ts, 1007, 20))
|
|
>array2.length : Symbol(Array.length, Decl(lib.d.ts, 1007, 20))
|
|
>array2 : Symbol(array2, Decl(typeInferenceWithTupleType.ts, 8, 31))
|
|
>length : Symbol(Array.length, Decl(lib.d.ts, 1007, 20))
|
|
|
|
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.d.ts, 1007, 20))
|
|
>array1 : Symbol(array1, Decl(typeInferenceWithTupleType.ts, 8, 19))
|
|
>length : Symbol(Array.length, Decl(lib.d.ts, 1007, 20))
|
|
|
|
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.d.ts, 1016, 29))
|
|
>zipResult : Symbol(zipResult, Decl(typeInferenceWithTupleType.ts, 13, 7))
|
|
>push : Symbol(Array.push, Decl(lib.d.ts, 1016, 29))
|
|
>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)
|
|
|
|
|