TypeScript/tests/baselines/reference/genericClasses4.types
2015-04-15 16:44:20 -07:00

99 lines
1.6 KiB
Plaintext

=== tests/cases/compiler/genericClasses4.ts ===
// once caused stack overflow
class Vec2_T<A>
>Vec2_T : Vec2_T<A>
>A : A
{
constructor(public x: A, public y: A) { }
>x : A
>A : A
>y : A
>A : A
fmap<B>(f: (a: A) => B): Vec2_T<B> {
>fmap : <B>(f: (a: A) => B) => Vec2_T<B>
>B : B
>f : (a: A) => B
>a : A
>A : A
>B : B
>Vec2_T : Vec2_T<A>
>B : B
var x:B = f(this.x);
>x : B
>B : B
>f(this.x) : B
>f : (a: A) => B
>this.x : A
>this : Vec2_T<A>
>x : A
var y:B = f(this.y);
>y : B
>B : B
>f(this.y) : B
>f : (a: A) => B
>this.y : A
>this : Vec2_T<A>
>y : A
var retval: Vec2_T<B> = new Vec2_T(x, y);
>retval : Vec2_T<B>
>Vec2_T : Vec2_T<A>
>B : B
>new Vec2_T(x, y) : Vec2_T<B>
>Vec2_T : typeof Vec2_T
>x : B
>y : B
return retval;
>retval : Vec2_T<B>
}
apply<B>(f: Vec2_T<(a: A) => B>): Vec2_T<B> {
>apply : <B>(f: Vec2_T<(a: A) => B>) => Vec2_T<B>
>B : B
>f : Vec2_T<(a: A) => B>
>Vec2_T : Vec2_T<A>
>a : A
>A : A
>B : B
>Vec2_T : Vec2_T<A>
>B : B
var x:B = f.x(this.x);
>x : B
>B : B
>f.x(this.x) : B
>f.x : (a: A) => B
>f : Vec2_T<(a: A) => B>
>x : (a: A) => B
>this.x : A
>this : Vec2_T<A>
>x : A
var y:B = f.y(this.y);
>y : B
>B : B
>f.y(this.y) : B
>f.y : (a: A) => B
>f : Vec2_T<(a: A) => B>
>y : (a: A) => B
>this.y : A
>this : Vec2_T<A>
>y : A
var retval: Vec2_T<B> = new Vec2_T(x, y);
>retval : Vec2_T<B>
>Vec2_T : Vec2_T<A>
>B : B
>new Vec2_T(x, y) : Vec2_T<B>
>Vec2_T : typeof Vec2_T
>x : B
>y : B
return retval;
>retval : Vec2_T<B>
}
}