90 lines
1.6 KiB
Text
90 lines
1.6 KiB
Text
=== tests/cases/compiler/typeInferenceReturnTypeCallback.ts ===
|
|
interface IList<A> {
|
|
>IList : IList<A>
|
|
>A : A
|
|
|
|
map<B>(f: (t: A) => B): IList<B>;
|
|
>map : <B>(f: (t: A) => B) => IList<B>
|
|
>B : B
|
|
>f : (t: A) => B
|
|
>t : A
|
|
>A : A
|
|
>B : B
|
|
>IList : IList<A>
|
|
>B : B
|
|
}
|
|
|
|
class Nil<C> implements IList<C>{
|
|
>Nil : Nil<C>
|
|
>C : C
|
|
>IList : IList<A>
|
|
>C : C
|
|
|
|
map<D>(f: (t: C) => D): IList<D> {
|
|
>map : <D>(f: (t: C) => D) => IList<D>
|
|
>D : D
|
|
>f : (t: C) => D
|
|
>t : C
|
|
>C : C
|
|
>D : D
|
|
>IList : IList<A>
|
|
>D : D
|
|
|
|
return null;
|
|
>null : null
|
|
}
|
|
}
|
|
|
|
class Cons<T> implements IList<T>{
|
|
>Cons : Cons<T>
|
|
>T : T
|
|
>IList : IList<A>
|
|
>T : T
|
|
|
|
map<U>(f: (t: T) => U): IList<U> {
|
|
>map : <U>(f: (t: T) => U) => IList<U>
|
|
>U : U
|
|
>f : (t: T) => U
|
|
>t : T
|
|
>T : T
|
|
>U : U
|
|
>IList : IList<A>
|
|
>U : U
|
|
|
|
return this.foldRight(new Nil<U>(), (t, acc) => {
|
|
>this.foldRight(new Nil<U>(), (t, acc) => { return new Cons<U>(); }) : Nil<U>
|
|
>this.foldRight : <E>(z: E, f: (t: T, acc: E) => E) => E
|
|
>this : Cons<T>
|
|
>foldRight : <E>(z: E, f: (t: T, acc: E) => E) => E
|
|
>new Nil<U>() : Nil<U>
|
|
>Nil : typeof Nil
|
|
>U : U
|
|
>(t, acc) => { return new Cons<U>(); } : (t: T, acc: Nil<U>) => Cons<U>
|
|
>t : T
|
|
>acc : Nil<U>
|
|
|
|
return new Cons<U>();
|
|
>new Cons<U>() : Cons<U>
|
|
>Cons : typeof Cons
|
|
>U : U
|
|
|
|
});
|
|
}
|
|
|
|
foldRight<E>(z: E, f: (t: T, acc: E) => E): E {
|
|
>foldRight : <E>(z: E, f: (t: T, acc: E) => E) => E
|
|
>E : E
|
|
>z : E
|
|
>E : E
|
|
>f : (t: T, acc: E) => E
|
|
>t : T
|
|
>T : T
|
|
>acc : E
|
|
>E : E
|
|
>E : E
|
|
>E : E
|
|
|
|
return null;
|
|
>null : null
|
|
}
|
|
}
|