2014-08-15 23:33:16 +02:00
|
|
|
=== 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 }
|
2015-04-13 23:01:57 +02:00
|
|
|
>A : A, Symbol(A, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 0, 0))
|
|
|
|
>foo : number, Symbol(foo, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 3, 13))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
interface B extends A { bar: string; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>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))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
interface C extends B { baz: boolean; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>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))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var a: A;
|
2015-04-13 23:01:57 +02:00
|
|
|
>a : A, Symbol(a, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 6, 3))
|
|
|
|
>A : A, Symbol(A, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 0, 0))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var b: B;
|
2015-04-13 23:01:57 +02:00
|
|
|
>b : B, Symbol(b, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 7, 3))
|
|
|
|
>B : B, Symbol(B, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 3, 27))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
var c: C;
|
2015-04-13 23:01:57 +02:00
|
|
|
>c : C, Symbol(c, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 8, 3))
|
|
|
|
>C : C, Symbol(C, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 4, 38))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
function foo<T, U, V>(x: T, y: U, z: V): V { return z; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>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))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
//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
|
2015-04-13 23:01:57 +02:00
|
|
|
>foo : <T, U, V>(x: T, y: U, z: V) => V, Symbol(foo, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 8, 9))
|
2015-04-13 21:36:11 +02:00
|
|
|
>1 : number
|
|
|
|
>2 : number
|
|
|
|
>3 : number
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
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; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>foo : <T, U, V>(x: T, y: U, z: V) => V, Symbol(foo, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 8, 9))
|
2014-08-15 23:33:16 +02:00
|
|
|
>{ x: 1 } : { x: number; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : number, Symbol(x, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 14, 5))
|
2015-04-13 21:36:11 +02:00
|
|
|
>1 : number
|
2014-08-15 23:33:16 +02:00
|
|
|
>{ x: 1, y: '' } : { x: number; y: string; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : number, Symbol(x, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 14, 15))
|
2015-04-13 21:36:11 +02:00
|
|
|
>1 : number
|
2015-04-13 23:01:57 +02:00
|
|
|
>y : string, Symbol(y, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 14, 21))
|
2015-04-13 21:36:11 +02:00
|
|
|
>'' : string
|
2014-08-15 23:33:16 +02:00
|
|
|
>{ x: 2, y: '', z: true } : { x: number; y: string; z: boolean; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : number, Symbol(x, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 14, 32))
|
2015-04-13 21:36:11 +02:00
|
|
|
>2 : number
|
2015-04-13 23:01:57 +02:00
|
|
|
>y : string, Symbol(y, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 14, 38))
|
2015-04-13 21:36:11 +02:00
|
|
|
>'' : string
|
2015-04-13 23:01:57 +02:00
|
|
|
>z : boolean, Symbol(z, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 14, 45))
|
2015-04-13 21:36:11 +02:00
|
|
|
>true : boolean
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
foo(a, b, c);
|
|
|
|
>foo(a, b, c) : C
|
2015-04-13 23:01:57 +02:00
|
|
|
>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))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
foo(a, b, { foo: 1, bar: '', hm: true });
|
|
|
|
>foo(a, b, { foo: 1, bar: '', hm: true }) : { foo: number; bar: string; hm: boolean; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>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))
|
2014-08-15 23:33:16 +02:00
|
|
|
>{ foo: 1, bar: '', hm: true } : { foo: number; bar: string; hm: boolean; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>foo : number, Symbol(foo, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 16, 11))
|
2015-04-13 21:36:11 +02:00
|
|
|
>1 : number
|
2015-04-13 23:01:57 +02:00
|
|
|
>bar : string, Symbol(bar, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 16, 19))
|
2015-04-13 21:36:11 +02:00
|
|
|
>'' : string
|
2015-04-13 23:01:57 +02:00
|
|
|
>hm : boolean, Symbol(hm, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 16, 28))
|
2015-04-13 21:36:11 +02:00
|
|
|
>true : boolean
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
foo((x: number, y) => { }, (x) => { }, () => { });
|
|
|
|
>foo((x: number, y) => { }, (x) => { }, () => { }) : () => void
|
2015-04-13 23:01:57 +02:00
|
|
|
>foo : <T, U, V>(x: T, y: U, z: V) => V, Symbol(foo, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 8, 9))
|
2014-08-15 23:33:16 +02:00
|
|
|
>(x: number, y) => { } : (x: number, y: any) => void
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : number, Symbol(x, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 17, 5))
|
|
|
|
>y : any, Symbol(y, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 17, 15))
|
2014-08-15 23:33:16 +02:00
|
|
|
>(x) => { } : (x: any) => void
|
2015-04-13 23:01:57 +02:00
|
|
|
>x : any, Symbol(x, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 17, 28))
|
2014-08-15 23:33:16 +02:00
|
|
|
>() => { } : () => void
|
|
|
|
|
|
|
|
function foo2<T extends A, U, V>(x: T, y: U, z: V): V { return z; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>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))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
//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
|
2015-04-13 23:01:57 +02:00
|
|
|
>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))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
foo(a, b, c);
|
|
|
|
>foo(a, b, c) : C
|
2015-04-13 23:01:57 +02:00
|
|
|
>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))
|
2014-08-15 23:33:16 +02:00
|
|
|
|
|
|
|
foo(b, b, { foo: 1, bar: '', hm: '' });
|
|
|
|
>foo(b, b, { foo: 1, bar: '', hm: '' }) : { foo: number; bar: string; hm: string; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>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))
|
2014-08-15 23:33:16 +02:00
|
|
|
>{ foo: 1, bar: '', hm: '' } : { foo: number; bar: string; hm: string; }
|
2015-04-13 23:01:57 +02:00
|
|
|
>foo : number, Symbol(foo, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 23, 11))
|
2015-04-13 21:36:11 +02:00
|
|
|
>1 : number
|
2015-04-13 23:01:57 +02:00
|
|
|
>bar : string, Symbol(bar, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 23, 19))
|
2015-04-13 21:36:11 +02:00
|
|
|
>'' : string
|
2015-04-13 23:01:57 +02:00
|
|
|
>hm : string, Symbol(hm, Decl(typeParameterAsTypeParameterConstraintTransitively.ts, 23, 28))
|
2015-04-13 21:36:11 +02:00
|
|
|
>'' : string
|
2014-08-15 23:33:16 +02:00
|
|
|
|