163 lines
8.3 KiB
Text
163 lines
8.3 KiB
Text
=== tests/cases/conformance/types/typeParameters/typeArgumentLists/functionConstraintSatisfaction3.ts ===
|
|
// satisfaction of a constraint to Function, no errors expected
|
|
|
|
function foo<T extends (x: string) => string>(x: T): T { return x; }
|
|
>foo : <T extends (x: string) => string>(x: T) => T, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,0,0))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,2,13))
|
|
>x : string, Symbol(x,Decl(functionConstraintSatisfaction3.ts,2,24))
|
|
>x : T, Symbol(x,Decl(functionConstraintSatisfaction3.ts,2,46))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,2,13))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,2,13))
|
|
>x : T, Symbol(x,Decl(functionConstraintSatisfaction3.ts,2,46))
|
|
|
|
interface I {
|
|
>I : I, Symbol(I,Decl(functionConstraintSatisfaction3.ts,2,68))
|
|
|
|
(): string;
|
|
}
|
|
var i: I;
|
|
>i : I, Symbol(i,Decl(functionConstraintSatisfaction3.ts,7,3))
|
|
>I : I, Symbol(I,Decl(functionConstraintSatisfaction3.ts,2,68))
|
|
|
|
class C {
|
|
>C : C, Symbol(C,Decl(functionConstraintSatisfaction3.ts,7,9))
|
|
|
|
foo: string;
|
|
>foo : string, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,9,9))
|
|
}
|
|
|
|
var a: { (): string };
|
|
>a : () => string, Symbol(a,Decl(functionConstraintSatisfaction3.ts,13,3))
|
|
|
|
var b: { new (): string };
|
|
>b : new () => string, Symbol(b,Decl(functionConstraintSatisfaction3.ts,14,3))
|
|
|
|
var c: { (): string; (x): string };
|
|
>c : { (): string; (x: any): string; }, Symbol(c,Decl(functionConstraintSatisfaction3.ts,15,3))
|
|
>x : any, Symbol(x,Decl(functionConstraintSatisfaction3.ts,15,22))
|
|
|
|
var r1 = foo((x) => x);
|
|
>r1 : (x: any) => any, Symbol(r1,Decl(functionConstraintSatisfaction3.ts,17,3))
|
|
>foo((x) => x) : (x: any) => any
|
|
>foo : <T extends (x: string) => string>(x: T) => T, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,0,0))
|
|
>(x) => x : (x: any) => any
|
|
>x : any, Symbol(x,Decl(functionConstraintSatisfaction3.ts,17,14))
|
|
>x : any, Symbol(x,Decl(functionConstraintSatisfaction3.ts,17,14))
|
|
|
|
var r2 = foo((x: string) => x);
|
|
>r2 : (x: string) => string, Symbol(r2,Decl(functionConstraintSatisfaction3.ts,18,3))
|
|
>foo((x: string) => x) : (x: string) => string
|
|
>foo : <T extends (x: string) => string>(x: T) => T, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,0,0))
|
|
>(x: string) => x : (x: string) => string
|
|
>x : string, Symbol(x,Decl(functionConstraintSatisfaction3.ts,18,14))
|
|
>x : string, Symbol(x,Decl(functionConstraintSatisfaction3.ts,18,14))
|
|
|
|
var r3 = foo(function (x) { return x });
|
|
>r3 : (x: any) => any, Symbol(r3,Decl(functionConstraintSatisfaction3.ts,19,3))
|
|
>foo(function (x) { return x }) : (x: any) => any
|
|
>foo : <T extends (x: string) => string>(x: T) => T, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,0,0))
|
|
>function (x) { return x } : (x: any) => any
|
|
>x : any, Symbol(x,Decl(functionConstraintSatisfaction3.ts,19,23))
|
|
>x : any, Symbol(x,Decl(functionConstraintSatisfaction3.ts,19,23))
|
|
|
|
var r4 = foo(function (x: string) { return x });
|
|
>r4 : (x: string) => string, Symbol(r4,Decl(functionConstraintSatisfaction3.ts,20,3))
|
|
>foo(function (x: string) { return x }) : (x: string) => string
|
|
>foo : <T extends (x: string) => string>(x: T) => T, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,0,0))
|
|
>function (x: string) { return x } : (x: string) => string
|
|
>x : string, Symbol(x,Decl(functionConstraintSatisfaction3.ts,20,23))
|
|
>x : string, Symbol(x,Decl(functionConstraintSatisfaction3.ts,20,23))
|
|
|
|
var r5 = foo(i);
|
|
>r5 : I, Symbol(r5,Decl(functionConstraintSatisfaction3.ts,21,3))
|
|
>foo(i) : I
|
|
>foo : <T extends (x: string) => string>(x: T) => T, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,0,0))
|
|
>i : I, Symbol(i,Decl(functionConstraintSatisfaction3.ts,7,3))
|
|
|
|
var r8 = foo(c);
|
|
>r8 : { (): string; (x: any): string; }, Symbol(r8,Decl(functionConstraintSatisfaction3.ts,22,3))
|
|
>foo(c) : { (): string; (x: any): string; }
|
|
>foo : <T extends (x: string) => string>(x: T) => T, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,0,0))
|
|
>c : { (): string; (x: any): string; }, Symbol(c,Decl(functionConstraintSatisfaction3.ts,15,3))
|
|
|
|
interface I2<T> {
|
|
>I2 : I2<T>, Symbol(I2,Decl(functionConstraintSatisfaction3.ts,22,16))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,24,13))
|
|
|
|
(x: T): T;
|
|
>x : T, Symbol(x,Decl(functionConstraintSatisfaction3.ts,25,5))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,24,13))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,24,13))
|
|
}
|
|
var i2: I2<string>;
|
|
>i2 : I2<string>, Symbol(i2,Decl(functionConstraintSatisfaction3.ts,27,3))
|
|
>I2 : I2<T>, Symbol(I2,Decl(functionConstraintSatisfaction3.ts,22,16))
|
|
|
|
class C2<T> {
|
|
>C2 : C2<T>, Symbol(C2,Decl(functionConstraintSatisfaction3.ts,27,19))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,29,9))
|
|
|
|
foo: T;
|
|
>foo : T, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,29,13))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,29,9))
|
|
}
|
|
|
|
var a2: { <T>(x: T): T };
|
|
>a2 : <T>(x: T) => T, Symbol(a2,Decl(functionConstraintSatisfaction3.ts,33,3))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,33,11))
|
|
>x : T, Symbol(x,Decl(functionConstraintSatisfaction3.ts,33,14))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,33,11))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,33,11))
|
|
|
|
var b2: { new <T>(x: T): T };
|
|
>b2 : new <T>(x: T) => T, Symbol(b2,Decl(functionConstraintSatisfaction3.ts,34,3))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,34,15))
|
|
>x : T, Symbol(x,Decl(functionConstraintSatisfaction3.ts,34,18))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,34,15))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,34,15))
|
|
|
|
var c2: { <T>(x: T): T; <T>(x: T, y: T): T };
|
|
>c2 : { <T>(x: T): T; <T>(x: T, y: T): T; }, Symbol(c2,Decl(functionConstraintSatisfaction3.ts,35,3))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,35,11))
|
|
>x : T, Symbol(x,Decl(functionConstraintSatisfaction3.ts,35,14))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,35,11))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,35,11))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,35,25))
|
|
>x : T, Symbol(x,Decl(functionConstraintSatisfaction3.ts,35,28))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,35,25))
|
|
>y : T, Symbol(y,Decl(functionConstraintSatisfaction3.ts,35,33))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,35,25))
|
|
>T : T, Symbol(T,Decl(functionConstraintSatisfaction3.ts,35,25))
|
|
|
|
var r9 = foo(function <U>(x: U) { return x; });
|
|
>r9 : <U>(x: U) => U, Symbol(r9,Decl(functionConstraintSatisfaction3.ts,37,3))
|
|
>foo(function <U>(x: U) { return x; }) : <U>(x: U) => U
|
|
>foo : <T extends (x: string) => string>(x: T) => T, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,0,0))
|
|
>function <U>(x: U) { return x; } : <U>(x: U) => U
|
|
>U : U, Symbol(U,Decl(functionConstraintSatisfaction3.ts,37,23))
|
|
>x : U, Symbol(x,Decl(functionConstraintSatisfaction3.ts,37,26))
|
|
>U : U, Symbol(U,Decl(functionConstraintSatisfaction3.ts,37,23))
|
|
>x : U, Symbol(x,Decl(functionConstraintSatisfaction3.ts,37,26))
|
|
|
|
var r10 = foo(<U extends string>(x: U) => x);
|
|
>r10 : <U extends string>(x: U) => U, Symbol(r10,Decl(functionConstraintSatisfaction3.ts,38,3))
|
|
>foo(<U extends string>(x: U) => x) : <U extends string>(x: U) => U
|
|
>foo : <T extends (x: string) => string>(x: T) => T, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,0,0))
|
|
><U extends string>(x: U) => x : <U extends string>(x: U) => U
|
|
>U : U, Symbol(U,Decl(functionConstraintSatisfaction3.ts,38,15))
|
|
>x : U, Symbol(x,Decl(functionConstraintSatisfaction3.ts,38,33))
|
|
>U : U, Symbol(U,Decl(functionConstraintSatisfaction3.ts,38,15))
|
|
>x : U, Symbol(x,Decl(functionConstraintSatisfaction3.ts,38,33))
|
|
|
|
var r12 = foo(i2);
|
|
>r12 : I2<string>, Symbol(r12,Decl(functionConstraintSatisfaction3.ts,39,3))
|
|
>foo(i2) : I2<string>
|
|
>foo : <T extends (x: string) => string>(x: T) => T, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,0,0))
|
|
>i2 : I2<string>, Symbol(i2,Decl(functionConstraintSatisfaction3.ts,27,3))
|
|
|
|
var r15 = foo(c2);
|
|
>r15 : { <T>(x: T): T; <T>(x: T, y: T): T; }, Symbol(r15,Decl(functionConstraintSatisfaction3.ts,40,3))
|
|
>foo(c2) : { <T>(x: T): T; <T>(x: T, y: T): T; }
|
|
>foo : <T extends (x: string) => string>(x: T) => T, Symbol(foo,Decl(functionConstraintSatisfaction3.ts,0,0))
|
|
>c2 : { <T>(x: T): T; <T>(x: T, y: T): T; }, Symbol(c2,Decl(functionConstraintSatisfaction3.ts,35,3))
|
|
|