1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
|
=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments2.ts ===
// Function typed arguments with multiple signatures must be passed an implementation that matches all of them
// Inferences are made quadratic-pairwise to and from these overload sets
module NonGenericParameter {
>NonGenericParameter : Symbol(NonGenericParameter, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 0, 0))
var a: {
>a : Symbol(a, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 4, 7))
new(x: boolean): boolean;
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 5, 12))
new(x: string): string;
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 6, 12))
}
function foo4(cb: typeof a) {
>foo4 : Symbol(foo4, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 7, 5))
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 9, 18))
>a : Symbol(a, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 4, 7))
return cb;
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 9, 18))
}
var b: { new <T, U>(x: T): U }
>b : Symbol(b, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 13, 7))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 13, 18))
>U : Symbol(U, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 13, 20))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 13, 24))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 13, 18))
>U : Symbol(U, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 13, 20))
var r3 = foo4(b); // ok
>r3 : Symbol(r3, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 14, 7))
>foo4 : Symbol(foo4, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 7, 5))
>b : Symbol(b, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 13, 7))
}
module GenericParameter {
>GenericParameter : Symbol(GenericParameter, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 15, 1))
function foo5<T>(cb: { new(x: T): string; new(x: number): T }) {
>foo5 : Symbol(foo5, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 17, 25))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 18, 18))
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 18, 21))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 18, 31))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 18, 18))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 18, 50))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 18, 18))
return cb;
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 18, 21))
}
var a: { new <T>(x: T): T };
>a : Symbol(a, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 22, 7))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 22, 18))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 22, 21))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 22, 18))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 22, 18))
var r6 = foo5(a); // ok
>r6 : Symbol(r6, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 23, 7))
>foo5 : Symbol(foo5, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 17, 25))
>a : Symbol(a, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 22, 7))
function foo6<T>(cb: { new(x: T): string; new(x: T, y?: T): string }) {
>foo6 : Symbol(foo6, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 23, 21))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 25, 18))
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 25, 21))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 25, 31))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 25, 18))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 25, 50))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 25, 18))
>y : Symbol(y, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 25, 55))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 25, 18))
return cb;
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 25, 21))
}
var b: { new <T>(x: T, y: T): string };
>b : Symbol(b, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 29, 7))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 29, 18))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 29, 21))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 29, 18))
>y : Symbol(y, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 29, 26))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 29, 18))
var r10 = foo6(b); // error
>r10 : Symbol(r10, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 30, 7))
>foo6 : Symbol(foo6, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 23, 21))
>b : Symbol(b, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 29, 7))
function foo7<T>(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) {
>foo7 : Symbol(foo7, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 30, 22))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 32, 18))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 32, 21))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 32, 18))
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 32, 25))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 32, 36))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 32, 18))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 32, 55))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 32, 18))
>y : Symbol(y, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 32, 60))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 32, 18))
return cb;
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 32, 25))
}
var r13 = foo7(1, a); // ok
>r13 : Symbol(r13, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 36, 7))
>foo7 : Symbol(foo7, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 30, 22))
>a : Symbol(a, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 22, 7))
var c: { new<T>(x: T): number; new<T>(x: number): T; }
>c : Symbol(c, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 37, 7))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 37, 17))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 37, 20))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 37, 17))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 37, 39))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 37, 42))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 37, 39))
var r14 = foo7(1, c); // ok
>r14 : Symbol(r14, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 38, 7))
>foo7 : Symbol(foo7, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 30, 22))
>c : Symbol(c, Decl(genericCallWithOverloadedConstructorTypedArguments2.ts, 37, 7))
}
|