54 lines
2.4 KiB
Text
54 lines
2.4 KiB
Text
=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments3.ts ===
|
|
// No inference is made from function typed arguments which have multiple call signatures
|
|
|
|
var a: {
|
|
>a : Symbol(a, Decl(genericCallWithFunctionTypedArguments3.ts, 2, 3))
|
|
|
|
(x: boolean): boolean;
|
|
>x : Symbol(x, Decl(genericCallWithFunctionTypedArguments3.ts, 3, 5))
|
|
|
|
(x: string): any;
|
|
>x : Symbol(x, Decl(genericCallWithFunctionTypedArguments3.ts, 4, 5))
|
|
}
|
|
|
|
function foo4<T, U>(cb: (x: T) => U) {
|
|
>foo4 : Symbol(foo4, Decl(genericCallWithFunctionTypedArguments3.ts, 5, 1))
|
|
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments3.ts, 7, 14))
|
|
>U : Symbol(U, Decl(genericCallWithFunctionTypedArguments3.ts, 7, 16))
|
|
>cb : Symbol(cb, Decl(genericCallWithFunctionTypedArguments3.ts, 7, 20))
|
|
>x : Symbol(x, Decl(genericCallWithFunctionTypedArguments3.ts, 7, 25))
|
|
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments3.ts, 7, 14))
|
|
>U : Symbol(U, Decl(genericCallWithFunctionTypedArguments3.ts, 7, 16))
|
|
|
|
var u: U;
|
|
>u : Symbol(u, Decl(genericCallWithFunctionTypedArguments3.ts, 8, 7))
|
|
>U : Symbol(U, Decl(genericCallWithFunctionTypedArguments3.ts, 7, 16))
|
|
|
|
return u;
|
|
>u : Symbol(u, Decl(genericCallWithFunctionTypedArguments3.ts, 8, 7))
|
|
}
|
|
|
|
var r = foo4(a); // T is {} (candidates boolean and string), U is any (candidates any and boolean)
|
|
>r : Symbol(r, Decl(genericCallWithFunctionTypedArguments3.ts, 12, 3))
|
|
>foo4 : Symbol(foo4, Decl(genericCallWithFunctionTypedArguments3.ts, 5, 1))
|
|
>a : Symbol(a, Decl(genericCallWithFunctionTypedArguments3.ts, 2, 3))
|
|
|
|
var b: {
|
|
>b : Symbol(b, Decl(genericCallWithFunctionTypedArguments3.ts, 14, 3))
|
|
|
|
<T>(x: boolean): T;
|
|
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments3.ts, 15, 5))
|
|
>x : Symbol(x, Decl(genericCallWithFunctionTypedArguments3.ts, 15, 8))
|
|
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments3.ts, 15, 5))
|
|
|
|
<T>(x: T): any;
|
|
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments3.ts, 16, 5))
|
|
>x : Symbol(x, Decl(genericCallWithFunctionTypedArguments3.ts, 16, 8))
|
|
>T : Symbol(T, Decl(genericCallWithFunctionTypedArguments3.ts, 16, 5))
|
|
}
|
|
|
|
var r2 = foo4(b); // T is {} (candidates boolean and {}), U is any (candidates any and {})
|
|
>r2 : Symbol(r2, Decl(genericCallWithFunctionTypedArguments3.ts, 19, 3))
|
|
>foo4 : Symbol(foo4, Decl(genericCallWithFunctionTypedArguments3.ts, 5, 1))
|
|
>b : Symbol(b, Decl(genericCallWithFunctionTypedArguments3.ts, 14, 3))
|
|
|