2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/conformance/types/typeParameters/typeParameterLists/typeParametersAvailableInNestedScope.ts ===
|
|
|
|
class C<T> {
|
|
|
|
>C : C<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
data: T;
|
|
|
|
>data : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
x = <U>(a: U) => {
|
|
|
|
>x : <U>(a: U) => T
|
2014-08-22 03:39:46 +02:00
|
|
|
><U>(a: U) => { var y: T; return y; } : <U>(a: U) => T
|
2014-08-15 23:33:16 +02:00
|
|
|
>U : U
|
|
|
|
>a : U
|
|
|
|
>U : U
|
|
|
|
|
|
|
|
var y: T;
|
|
|
|
>y : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
return y;
|
|
|
|
>y : T
|
|
|
|
}
|
|
|
|
|
|
|
|
foo() {
|
|
|
|
>foo : () => T
|
|
|
|
|
|
|
|
function temp<U>(a: U) {
|
|
|
|
>temp : <U>(a: U) => T
|
|
|
|
>U : U
|
|
|
|
>a : U
|
|
|
|
>U : U
|
|
|
|
|
|
|
|
var y: T;
|
|
|
|
>y : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
return y;
|
|
|
|
>y : T
|
|
|
|
}
|
|
|
|
return temp(<T>null);
|
|
|
|
>temp(<T>null) : T
|
|
|
|
>temp : <U>(a: U) => T
|
|
|
|
><T>null : T
|
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
var c = new C<number>();
|
|
|
|
>c : C<number>
|
|
|
|
>new C<number>() : C<number>
|
|
|
|
>C : typeof C
|
|
|
|
|
|
|
|
c.data = c.x(null);
|
|
|
|
>c.data = c.x(null) : number
|
|
|
|
>c.data : number
|
|
|
|
>c : C<number>
|
|
|
|
>data : number
|
|
|
|
>c.x(null) : number
|
|
|
|
>c.x : <U>(a: U) => number
|
|
|
|
>c : C<number>
|
|
|
|
>x : <U>(a: U) => number
|
|
|
|
|
|
|
|
c.data = c.foo();
|
|
|
|
>c.data = c.foo() : number
|
|
|
|
>c.data : number
|
|
|
|
>c : C<number>
|
|
|
|
>data : number
|
|
|
|
>c.foo() : number
|
|
|
|
>c.foo : () => number
|
|
|
|
>c : C<number>
|
|
|
|
>foo : () => number
|
|
|
|
|