2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/recursiveTypeParameterReferenceError1.ts ===
|
|
|
|
class X<T> { }
|
|
|
|
>X : X<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
interface Foo<T> {
|
|
|
|
>Foo : Foo<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
z: Foo<X<T>>; // error
|
|
|
|
>z : Foo<X<T>>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Foo : Foo<T>
|
|
|
|
>X : X<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
var f: Foo<number>;
|
|
|
|
>f : Foo<number>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Foo : Foo<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var r = f.z;
|
|
|
|
>r : Foo<X<number>>
|
|
|
|
>f.z : Foo<X<number>>
|
|
|
|
>f : Foo<number>
|
|
|
|
>z : Foo<X<number>>
|
|
|
|
|
|
|
|
|
|
|
|
class C2<T> {
|
|
|
|
>C2 : C2<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
x: T;
|
|
|
|
>x : T
|
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
interface Foo2<T> {
|
|
|
|
>Foo2 : Foo2<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
ofC4: C2<{ x: T }> // ok
|
|
|
|
>ofC4 : C2<{ x: T; }>
|
2014-08-19 04:56:03 +02:00
|
|
|
>C2 : C2<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>x : T
|
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
var f2: Foo2<number>;
|
|
|
|
>f2 : Foo2<number>
|
2014-08-19 04:56:03 +02:00
|
|
|
>Foo2 : Foo2<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var r2 = f2.ofC4;
|
|
|
|
>r2 : C2<{ x: number; }>
|
|
|
|
>f2.ofC4 : C2<{ x: number; }>
|
|
|
|
>f2 : Foo2<number>
|
|
|
|
>ofC4 : C2<{ x: number; }>
|
|
|
|
|