TypeScript/tests/baselines/reference/genericCallWithFunctionTypedArguments4.types

67 lines
3.4 KiB
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithFunctionTypedArguments4.ts ===
// No inference is made from function typed arguments which have multiple call signatures
class C { foo: string }
2015-04-13 23:01:57 +02:00
>C : C, Symbol(C, Decl(genericCallWithFunctionTypedArguments4.ts, 0, 0))
>foo : string, Symbol(foo, Decl(genericCallWithFunctionTypedArguments4.ts, 2, 9))
2014-08-15 23:33:16 +02:00
class D { bar: string }
2015-04-13 23:01:57 +02:00
>D : D, Symbol(D, Decl(genericCallWithFunctionTypedArguments4.ts, 2, 23))
>bar : string, Symbol(bar, Decl(genericCallWithFunctionTypedArguments4.ts, 3, 9))
2014-08-15 23:33:16 +02:00
var a: {
2015-04-13 23:01:57 +02:00
>a : { new (x: boolean): C; new (x: string): D; }, Symbol(a, Decl(genericCallWithFunctionTypedArguments4.ts, 4, 3))
2014-08-15 23:33:16 +02:00
new(x: boolean): C;
2015-04-13 23:01:57 +02:00
>x : boolean, Symbol(x, Decl(genericCallWithFunctionTypedArguments4.ts, 5, 8))
>C : C, Symbol(C, Decl(genericCallWithFunctionTypedArguments4.ts, 0, 0))
2014-08-15 23:33:16 +02:00
new(x: string): D;
2015-04-13 23:01:57 +02:00
>x : string, Symbol(x, Decl(genericCallWithFunctionTypedArguments4.ts, 6, 8))
>D : D, Symbol(D, Decl(genericCallWithFunctionTypedArguments4.ts, 2, 23))
2014-08-15 23:33:16 +02:00
}
function foo4<T, U>(cb: new(x: T) => U) {
2015-04-13 23:01:57 +02:00
>foo4 : <T, U>(cb: new (x: T) => U) => U, Symbol(foo4, Decl(genericCallWithFunctionTypedArguments4.ts, 7, 1))
>T : T, Symbol(T, Decl(genericCallWithFunctionTypedArguments4.ts, 9, 14))
>U : U, Symbol(U, Decl(genericCallWithFunctionTypedArguments4.ts, 9, 16))
>cb : new (x: T) => U, Symbol(cb, Decl(genericCallWithFunctionTypedArguments4.ts, 9, 20))
>x : T, Symbol(x, Decl(genericCallWithFunctionTypedArguments4.ts, 9, 28))
>T : T, Symbol(T, Decl(genericCallWithFunctionTypedArguments4.ts, 9, 14))
>U : U, Symbol(U, Decl(genericCallWithFunctionTypedArguments4.ts, 9, 16))
2014-08-15 23:33:16 +02:00
var u: U;
2015-04-13 23:01:57 +02:00
>u : U, Symbol(u, Decl(genericCallWithFunctionTypedArguments4.ts, 10, 7))
>U : U, Symbol(U, Decl(genericCallWithFunctionTypedArguments4.ts, 9, 16))
2014-08-15 23:33:16 +02:00
return u;
2015-04-13 23:01:57 +02:00
>u : U, Symbol(u, Decl(genericCallWithFunctionTypedArguments4.ts, 10, 7))
2014-08-15 23:33:16 +02:00
}
var r = foo4(a); // T is {} (candidates boolean and string), U is {} (candidates C and D)
2015-04-13 23:01:57 +02:00
>r : D, Symbol(r, Decl(genericCallWithFunctionTypedArguments4.ts, 14, 3))
2014-08-15 23:33:16 +02:00
>foo4(a) : D
2015-04-13 23:01:57 +02:00
>foo4 : <T, U>(cb: new (x: T) => U) => U, Symbol(foo4, Decl(genericCallWithFunctionTypedArguments4.ts, 7, 1))
>a : { new (x: boolean): C; new (x: string): D; }, Symbol(a, Decl(genericCallWithFunctionTypedArguments4.ts, 4, 3))
2014-08-15 23:33:16 +02:00
var b: {
2015-04-13 23:01:57 +02:00
>b : { new <T>(x: boolean): T; new <T>(x: T): any; }, Symbol(b, Decl(genericCallWithFunctionTypedArguments4.ts, 16, 3))
2014-08-15 23:33:16 +02:00
new<T>(x: boolean): T;
2015-04-13 23:01:57 +02:00
>T : T, Symbol(T, Decl(genericCallWithFunctionTypedArguments4.ts, 17, 8))
>x : boolean, Symbol(x, Decl(genericCallWithFunctionTypedArguments4.ts, 17, 11))
>T : T, Symbol(T, Decl(genericCallWithFunctionTypedArguments4.ts, 17, 8))
2014-08-15 23:33:16 +02:00
new<T>(x: T): any;
2015-04-13 23:01:57 +02:00
>T : T, Symbol(T, Decl(genericCallWithFunctionTypedArguments4.ts, 18, 8))
>x : T, Symbol(x, Decl(genericCallWithFunctionTypedArguments4.ts, 18, 11))
>T : T, Symbol(T, Decl(genericCallWithFunctionTypedArguments4.ts, 18, 8))
2014-08-15 23:33:16 +02:00
}
var r2 = foo4(b); // T is {} (candidates boolean and {}), U is any (candidates any and {})
2015-04-13 23:01:57 +02:00
>r2 : any, Symbol(r2, Decl(genericCallWithFunctionTypedArguments4.ts, 21, 3))
2014-08-15 23:33:16 +02:00
>foo4(b) : any
2015-04-13 23:01:57 +02:00
>foo4 : <T, U>(cb: new (x: T) => U) => U, Symbol(foo4, Decl(genericCallWithFunctionTypedArguments4.ts, 7, 1))
>b : { new <T>(x: boolean): T; new <T>(x: T): any; }, Symbol(b, Decl(genericCallWithFunctionTypedArguments4.ts, 16, 3))
2014-08-15 23:33:16 +02:00