2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/genericsAndHigherOrderFunctions.ts ===
|
|
|
|
// no errors expected
|
|
|
|
|
|
|
|
var combine: <T, S>(f: (_: T) => S) =>
|
|
|
|
>combine : <T, S>(f: (_: T) => S) => <U>(g: (_: U) => T) => (x: U) => S
|
|
|
|
>T : T
|
|
|
|
>S : S
|
|
|
|
>f : (_: T) => S
|
|
|
|
>_ : T
|
|
|
|
>T : T
|
|
|
|
>S : S
|
|
|
|
|
|
|
|
<U>(g: (_: U) => T) =>
|
|
|
|
>U : U
|
|
|
|
>g : (_: U) => T
|
|
|
|
>_ : U
|
|
|
|
>U : U
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
(x: U) => S
|
|
|
|
>x : U
|
|
|
|
>U : U
|
|
|
|
>S : S
|
|
|
|
|
|
|
|
= <T, S>(f: (_: T) => S) =>
|
2014-08-22 03:39:46 +02:00
|
|
|
><T, S>(f: (_: T) => S) => <U>(g: (_: U) => T) => (x: U) => f(g(x)) : <T, S>(f: (_: T) => S) => <U>(g: (_: U) => T) => (x: U) => S
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
>S : S
|
|
|
|
>f : (_: T) => S
|
|
|
|
>_ : T
|
|
|
|
>T : T
|
|
|
|
>S : S
|
|
|
|
|
|
|
|
<U>(g: (_: U) => T) =>
|
2014-08-22 03:39:46 +02:00
|
|
|
><U>(g: (_: U) => T) => (x: U) => f(g(x)) : <U>(g: (_: U) => T) => (x: U) => S
|
2014-08-15 23:33:16 +02:00
|
|
|
>U : U
|
|
|
|
>g : (_: U) => T
|
|
|
|
>_ : U
|
|
|
|
>U : U
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
(x: U) => f(g(x))
|
|
|
|
>(x: U) => f(g(x)) : (x: U) => S
|
|
|
|
>x : U
|
|
|
|
>U : U
|
|
|
|
>f(g(x)) : S
|
|
|
|
>f : (_: T) => S
|
|
|
|
>g(x) : T
|
|
|
|
>g : (_: U) => T
|
|
|
|
>x : U
|
|
|
|
|
|
|
|
var foo: <K, N>(g: (x: K) => N) =>
|
|
|
|
>foo : <K, N>(g: (x: K) => N) => (h: <M>(_: (_: K) => (_: M) => M) => (_: M) => M) => <R>(f: (_: N) => (_: R) => R) => (_: R) => R
|
|
|
|
>K : K
|
|
|
|
>N : N
|
|
|
|
>g : (x: K) => N
|
|
|
|
>x : K
|
|
|
|
>K : K
|
|
|
|
>N : N
|
|
|
|
|
|
|
|
(h: <M>(_: (_: K) => (_: M) => M) => (_: M) => M) =>
|
|
|
|
>h : <M>(_: (_: K) => (_: M) => M) => (_: M) => M
|
|
|
|
>M : M
|
|
|
|
>_ : (_: K) => (_: M) => M
|
|
|
|
>_ : K
|
|
|
|
>K : K
|
|
|
|
>_ : M
|
|
|
|
>M : M
|
|
|
|
>M : M
|
|
|
|
>_ : M
|
|
|
|
>M : M
|
|
|
|
>M : M
|
|
|
|
|
|
|
|
<R>(f: (_: N) => (_: R) => R) => (_: R) => R
|
|
|
|
>R : R
|
|
|
|
>f : (_: N) => (_: R) => R
|
|
|
|
>_ : N
|
|
|
|
>N : N
|
|
|
|
>_ : R
|
|
|
|
>R : R
|
|
|
|
>R : R
|
|
|
|
>_ : R
|
|
|
|
>R : R
|
|
|
|
>R : R
|
|
|
|
|
|
|
|
= <K, N>(g: (x: K) => N) =>
|
2014-08-22 03:39:46 +02:00
|
|
|
><K, N>(g: (x: K) => N) => (h: <M>(_: (_: K) => (_: M) => M) => (_: M) => M) => <R>(f: (_: N) => (_: R) => R) => h(combine(f)(g)) : <K, N>(g: (x: K) => N) => (h: <M>(_: (_: K) => (_: M) => M) => (_: M) => M) => <R>(f: (_: N) => (_: R) => R) => (_: R) => R
|
2014-08-15 23:33:16 +02:00
|
|
|
>K : K
|
|
|
|
>N : N
|
|
|
|
>g : (x: K) => N
|
|
|
|
>x : K
|
|
|
|
>K : K
|
|
|
|
>N : N
|
|
|
|
|
|
|
|
(h: <M>(_: (_: K) => (_: M) => M) => (_: M) => M) =>
|
2014-08-22 03:39:46 +02:00
|
|
|
>(h: <M>(_: (_: K) => (_: M) => M) => (_: M) => M) => <R>(f: (_: N) => (_: R) => R) => h(combine(f)(g)) : (h: <M>(_: (_: K) => (_: M) => M) => (_: M) => M) => <R>(f: (_: N) => (_: R) => R) => (_: R) => R
|
2014-08-15 23:33:16 +02:00
|
|
|
>h : <M>(_: (_: K) => (_: M) => M) => (_: M) => M
|
|
|
|
>M : M
|
|
|
|
>_ : (_: K) => (_: M) => M
|
|
|
|
>_ : K
|
|
|
|
>K : K
|
|
|
|
>_ : M
|
|
|
|
>M : M
|
|
|
|
>M : M
|
|
|
|
>_ : M
|
|
|
|
>M : M
|
|
|
|
>M : M
|
|
|
|
|
|
|
|
<R>(f: (_: N) => (_: R) => R) => h(combine(f)(g))
|
|
|
|
><R>(f: (_: N) => (_: R) => R) => h(combine(f)(g)) : <R>(f: (_: N) => (_: R) => R) => (_: R) => R
|
|
|
|
>R : R
|
|
|
|
>f : (_: N) => (_: R) => R
|
|
|
|
>_ : N
|
|
|
|
>N : N
|
|
|
|
>_ : R
|
|
|
|
>R : R
|
|
|
|
>R : R
|
|
|
|
>h(combine(f)(g)) : (_: R) => R
|
|
|
|
>h : <M>(_: (_: K) => (_: M) => M) => (_: M) => M
|
|
|
|
>combine(f)(g) : (x: K) => (_: R) => R
|
|
|
|
>combine(f) : <U>(g: (_: U) => N) => (x: U) => (_: R) => R
|
|
|
|
>combine : <T, S>(f: (_: T) => S) => <U>(g: (_: U) => T) => (x: U) => S
|
|
|
|
>f : (_: N) => (_: R) => R
|
|
|
|
>g : (x: K) => N
|
|
|
|
|