145 lines
8.6 KiB
Text
145 lines
8.6 KiB
Text
=== tests/cases/conformance/types/typeParameters/typeArgumentLists/typeParameterAsTypeParameterConstraintTransitively.ts ===
|
|
// using a type parameter as a constraint for a type parameter is valid
|
|
// no errors expected
|
|
|
|
interface A { foo: number }
|
|
>A : A, Symbol(A,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,0,0))
|
|
>foo : number, Symbol(foo,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,3,13))
|
|
|
|
interface B extends A { bar: string; }
|
|
>B : B, Symbol(B,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,3,27))
|
|
>A : A, Symbol(A,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,0,0))
|
|
>bar : string, Symbol(bar,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,4,23))
|
|
|
|
interface C extends B { baz: boolean; }
|
|
>C : C, Symbol(C,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,4,38))
|
|
>B : B, Symbol(B,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,3,27))
|
|
>baz : boolean, Symbol(baz,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,5,23))
|
|
|
|
var a: A;
|
|
>a : A, Symbol(a,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,6,3))
|
|
>A : A, Symbol(A,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,0,0))
|
|
|
|
var b: B;
|
|
>b : B, Symbol(b,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,7,3))
|
|
>B : B, Symbol(B,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,3,27))
|
|
|
|
var c: C;
|
|
>c : C, Symbol(c,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,8,3))
|
|
>C : C, Symbol(C,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,4,38))
|
|
|
|
function foo<T, U, V>(x: T, y: U, z: V): V { return z; }
|
|
>foo : <T, U, V>(x: T, y: U, z: V) => V, Symbol(foo,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,8,9))
|
|
>T : T, Symbol(T,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,10,13))
|
|
>U : U, Symbol(U,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,10,15))
|
|
>V : V, Symbol(V,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,10,18))
|
|
>x : T, Symbol(x,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,10,22))
|
|
>T : T, Symbol(T,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,10,13))
|
|
>y : U, Symbol(y,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,10,27))
|
|
>U : U, Symbol(U,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,10,15))
|
|
>z : V, Symbol(z,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,10,33))
|
|
>V : V, Symbol(V,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,10,18))
|
|
>V : V, Symbol(V,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,10,18))
|
|
>z : V, Symbol(z,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,10,33))
|
|
|
|
//function foo<T, U extends T, V extends U>(x: T, y: U, z: V): V { return z; }
|
|
|
|
foo(1, 2, 3);
|
|
>foo(1, 2, 3) : number
|
|
>foo : <T, U, V>(x: T, y: U, z: V) => V, Symbol(foo,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,8,9))
|
|
>1 : number
|
|
>2 : number
|
|
>3 : number
|
|
|
|
foo({ x: 1 }, { x: 1, y: '' }, { x: 2, y: '', z: true });
|
|
>foo({ x: 1 }, { x: 1, y: '' }, { x: 2, y: '', z: true }) : { x: number; y: string; z: boolean; }
|
|
>foo : <T, U, V>(x: T, y: U, z: V) => V, Symbol(foo,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,8,9))
|
|
>{ x: 1 } : { x: number; }
|
|
>x : number, Symbol(x,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,14,5))
|
|
>1 : number
|
|
>{ x: 1, y: '' } : { x: number; y: string; }
|
|
>x : number, Symbol(x,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,14,15))
|
|
>1 : number
|
|
>y : string, Symbol(y,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,14,21))
|
|
>'' : string
|
|
>{ x: 2, y: '', z: true } : { x: number; y: string; z: boolean; }
|
|
>x : number, Symbol(x,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,14,32))
|
|
>2 : number
|
|
>y : string, Symbol(y,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,14,38))
|
|
>'' : string
|
|
>z : boolean, Symbol(z,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,14,45))
|
|
>true : boolean
|
|
|
|
foo(a, b, c);
|
|
>foo(a, b, c) : C
|
|
>foo : <T, U, V>(x: T, y: U, z: V) => V, Symbol(foo,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,8,9))
|
|
>a : A, Symbol(a,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,6,3))
|
|
>b : B, Symbol(b,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,7,3))
|
|
>c : C, Symbol(c,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,8,3))
|
|
|
|
foo(a, b, { foo: 1, bar: '', hm: true });
|
|
>foo(a, b, { foo: 1, bar: '', hm: true }) : { foo: number; bar: string; hm: boolean; }
|
|
>foo : <T, U, V>(x: T, y: U, z: V) => V, Symbol(foo,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,8,9))
|
|
>a : A, Symbol(a,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,6,3))
|
|
>b : B, Symbol(b,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,7,3))
|
|
>{ foo: 1, bar: '', hm: true } : { foo: number; bar: string; hm: boolean; }
|
|
>foo : number, Symbol(foo,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,16,11))
|
|
>1 : number
|
|
>bar : string, Symbol(bar,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,16,19))
|
|
>'' : string
|
|
>hm : boolean, Symbol(hm,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,16,28))
|
|
>true : boolean
|
|
|
|
foo((x: number, y) => { }, (x) => { }, () => { });
|
|
>foo((x: number, y) => { }, (x) => { }, () => { }) : () => void
|
|
>foo : <T, U, V>(x: T, y: U, z: V) => V, Symbol(foo,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,8,9))
|
|
>(x: number, y) => { } : (x: number, y: any) => void
|
|
>x : number, Symbol(x,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,17,5))
|
|
>y : any, Symbol(y,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,17,15))
|
|
>(x) => { } : (x: any) => void
|
|
>x : any, Symbol(x,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,17,28))
|
|
>() => { } : () => void
|
|
|
|
function foo2<T extends A, U, V>(x: T, y: U, z: V): V { return z; }
|
|
>foo2 : <T extends A, U, V>(x: T, y: U, z: V) => V, Symbol(foo2,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,17,50))
|
|
>T : T, Symbol(T,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,19,14))
|
|
>A : A, Symbol(A,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,0,0))
|
|
>U : U, Symbol(U,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,19,26))
|
|
>V : V, Symbol(V,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,19,29))
|
|
>x : T, Symbol(x,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,19,33))
|
|
>T : T, Symbol(T,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,19,14))
|
|
>y : U, Symbol(y,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,19,38))
|
|
>U : U, Symbol(U,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,19,26))
|
|
>z : V, Symbol(z,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,19,44))
|
|
>V : V, Symbol(V,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,19,29))
|
|
>V : V, Symbol(V,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,19,29))
|
|
>z : V, Symbol(z,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,19,44))
|
|
|
|
//function foo2<T extends A, U extends T, V extends U>(x: T, y: U, z: V): V { return z; }
|
|
foo(a, a, a);
|
|
>foo(a, a, a) : A
|
|
>foo : <T, U, V>(x: T, y: U, z: V) => V, Symbol(foo,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,8,9))
|
|
>a : A, Symbol(a,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,6,3))
|
|
>a : A, Symbol(a,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,6,3))
|
|
>a : A, Symbol(a,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,6,3))
|
|
|
|
foo(a, b, c);
|
|
>foo(a, b, c) : C
|
|
>foo : <T, U, V>(x: T, y: U, z: V) => V, Symbol(foo,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,8,9))
|
|
>a : A, Symbol(a,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,6,3))
|
|
>b : B, Symbol(b,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,7,3))
|
|
>c : C, Symbol(c,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,8,3))
|
|
|
|
foo(b, b, { foo: 1, bar: '', hm: '' });
|
|
>foo(b, b, { foo: 1, bar: '', hm: '' }) : { foo: number; bar: string; hm: string; }
|
|
>foo : <T, U, V>(x: T, y: U, z: V) => V, Symbol(foo,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,8,9))
|
|
>b : B, Symbol(b,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,7,3))
|
|
>b : B, Symbol(b,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,7,3))
|
|
>{ foo: 1, bar: '', hm: '' } : { foo: number; bar: string; hm: string; }
|
|
>foo : number, Symbol(foo,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,23,11))
|
|
>1 : number
|
|
>bar : string, Symbol(bar,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,23,19))
|
|
>'' : string
|
|
>hm : string, Symbol(hm,Decl(typeParameterAsTypeParameterConstraintTransitively.ts,23,28))
|
|
>'' : string
|
|
|