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
|
=== tests/cases/compiler/typeInferenceFBoundedTypeParams.ts ===
// Example from #6037
function fold<a, r>(values: a[], result: r, fold: (result: r, value: a) => r): r {
>fold : Symbol(fold, Decl(typeInferenceFBoundedTypeParams.ts, 0, 0))
>a : Symbol(a, Decl(typeInferenceFBoundedTypeParams.ts, 2, 14))
>r : Symbol(r, Decl(typeInferenceFBoundedTypeParams.ts, 2, 16))
>values : Symbol(values, Decl(typeInferenceFBoundedTypeParams.ts, 2, 20))
>a : Symbol(a, Decl(typeInferenceFBoundedTypeParams.ts, 2, 14))
>result : Symbol(result, Decl(typeInferenceFBoundedTypeParams.ts, 2, 32))
>r : Symbol(r, Decl(typeInferenceFBoundedTypeParams.ts, 2, 16))
>fold : Symbol(fold, Decl(typeInferenceFBoundedTypeParams.ts, 2, 43))
>result : Symbol(result, Decl(typeInferenceFBoundedTypeParams.ts, 2, 51))
>r : Symbol(r, Decl(typeInferenceFBoundedTypeParams.ts, 2, 16))
>value : Symbol(value, Decl(typeInferenceFBoundedTypeParams.ts, 2, 61))
>a : Symbol(a, Decl(typeInferenceFBoundedTypeParams.ts, 2, 14))
>r : Symbol(r, Decl(typeInferenceFBoundedTypeParams.ts, 2, 16))
>r : Symbol(r, Decl(typeInferenceFBoundedTypeParams.ts, 2, 16))
for (let value of values) {
>value : Symbol(value, Decl(typeInferenceFBoundedTypeParams.ts, 3, 12))
>values : Symbol(values, Decl(typeInferenceFBoundedTypeParams.ts, 2, 20))
result = fold(result, value);
>result : Symbol(result, Decl(typeInferenceFBoundedTypeParams.ts, 2, 32))
>fold : Symbol(fold, Decl(typeInferenceFBoundedTypeParams.ts, 2, 43))
>result : Symbol(result, Decl(typeInferenceFBoundedTypeParams.ts, 2, 32))
>value : Symbol(value, Decl(typeInferenceFBoundedTypeParams.ts, 3, 12))
}
return result;
>result : Symbol(result, Decl(typeInferenceFBoundedTypeParams.ts, 2, 32))
}
function append<a, b extends a>(values: a[], value: b): a[] {
>append : Symbol(append, Decl(typeInferenceFBoundedTypeParams.ts, 7, 1))
>a : Symbol(a, Decl(typeInferenceFBoundedTypeParams.ts, 9, 16))
>b : Symbol(b, Decl(typeInferenceFBoundedTypeParams.ts, 9, 18))
>a : Symbol(a, Decl(typeInferenceFBoundedTypeParams.ts, 9, 16))
>values : Symbol(values, Decl(typeInferenceFBoundedTypeParams.ts, 9, 32))
>a : Symbol(a, Decl(typeInferenceFBoundedTypeParams.ts, 9, 16))
>value : Symbol(value, Decl(typeInferenceFBoundedTypeParams.ts, 9, 44))
>b : Symbol(b, Decl(typeInferenceFBoundedTypeParams.ts, 9, 18))
>a : Symbol(a, Decl(typeInferenceFBoundedTypeParams.ts, 9, 16))
values.push(value);
>values.push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>values : Symbol(values, Decl(typeInferenceFBoundedTypeParams.ts, 9, 32))
>push : Symbol(Array.push, Decl(lib.es5.d.ts, --, --))
>value : Symbol(value, Decl(typeInferenceFBoundedTypeParams.ts, 9, 44))
return values;
>values : Symbol(values, Decl(typeInferenceFBoundedTypeParams.ts, 9, 32))
}
fold(
>fold : Symbol(fold, Decl(typeInferenceFBoundedTypeParams.ts, 0, 0))
[1, 2, 3],
[] as [string, string][],
(result, value) => append(
>result : Symbol(result, Decl(typeInferenceFBoundedTypeParams.ts, 17, 5))
>value : Symbol(value, Decl(typeInferenceFBoundedTypeParams.ts, 17, 12))
>append : Symbol(append, Decl(typeInferenceFBoundedTypeParams.ts, 7, 1))
result,
>result : Symbol(result, Decl(typeInferenceFBoundedTypeParams.ts, 17, 5))
["", ""]
)
);
|