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 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163
|
=== tests/cases/conformance/types/typeRelationships/typeInference/genericCallWithOverloadedConstructorTypedArguments.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(genericCallWithOverloadedConstructorTypedArguments.ts, 0, 0))
var a: {
>a : Symbol(a, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 4, 7))
new(x: boolean): boolean;
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 5, 12))
new(x: string): string;
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 6, 12))
}
function foo4(cb: typeof a) {
>foo4 : Symbol(foo4, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 7, 5))
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 9, 18))
>a : Symbol(a, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 4, 7))
return new cb(null);
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 9, 18))
}
var r = foo4(a);
>r : Symbol(r, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 13, 7))
>foo4 : Symbol(foo4, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 7, 5))
>a : Symbol(a, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 4, 7))
var b: { new <T>(x: T): T };
>b : Symbol(b, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 14, 7))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 14, 18))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 14, 21))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 14, 18))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 14, 18))
var r2 = foo4(b);
>r2 : Symbol(r2, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 15, 7))
>foo4 : Symbol(foo4, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 7, 5))
>b : Symbol(b, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 14, 7))
}
module GenericParameter {
>GenericParameter : Symbol(GenericParameter, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 16, 1))
function foo5<T>(cb: { new(x: T): string; new(x: number): T }) {
>foo5 : Symbol(foo5, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 18, 25))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 19, 18))
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 19, 21))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 19, 31))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 19, 18))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 19, 50))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 19, 18))
return cb;
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 19, 21))
}
var a: {
>a : Symbol(a, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 23, 7))
new (x: boolean): string;
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 24, 13))
new (x: number): boolean;
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 25, 13))
}
var r5 = foo5(a); // new{} => string; new(x:number) => {}
>r5 : Symbol(r5, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 27, 7))
>foo5 : Symbol(foo5, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 18, 25))
>a : Symbol(a, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 23, 7))
var b: { new<T>(x: T): string; new<T>(x: number): T; }
>b : Symbol(b, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 28, 7))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 28, 17))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 28, 20))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 28, 17))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 28, 39))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 28, 42))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 28, 39))
var r7 = foo5(b); // new any => string; new(x:number) => any
>r7 : Symbol(r7, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 29, 7))
>foo5 : Symbol(foo5, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 18, 25))
>b : Symbol(b, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 28, 7))
function foo6<T>(cb: { new(x: T): string; new(x: T, y?: T): string }) {
>foo6 : Symbol(foo6, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 29, 21))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 31, 18))
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 31, 21))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 31, 31))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 31, 18))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 31, 50))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 31, 18))
>y : Symbol(y, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 31, 55))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 31, 18))
return cb;
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 31, 21))
}
var r8 = foo6(a); // error
>r8 : Symbol(r8, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 35, 7))
>foo6 : Symbol(foo6, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 29, 21))
>a : Symbol(a, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 23, 7))
var r9 = foo6(b); // new any => string; new(x:any, y?:any) => string
>r9 : Symbol(r9, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 36, 7))
>foo6 : Symbol(foo6, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 29, 21))
>b : Symbol(b, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 28, 7))
function foo7<T>(x:T, cb: { new(x: T): string; new(x: T, y?: T): string }) {
>foo7 : Symbol(foo7, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 36, 21))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 38, 18))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 38, 21))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 38, 18))
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 38, 25))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 38, 36))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 38, 18))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 38, 55))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 38, 18))
>y : Symbol(y, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 38, 60))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 38, 18))
return cb;
>cb : Symbol(cb, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 38, 25))
}
var r13 = foo7(1, b); // new any => string; new(x:any, y?:any) => string
>r13 : Symbol(r13, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 42, 7))
>foo7 : Symbol(foo7, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 36, 21))
>b : Symbol(b, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 28, 7))
var c: { new <T>(x: T): string; <T>(x: number): T; }
>c : Symbol(c, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 43, 7))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 43, 18))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 43, 21))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 43, 18))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 43, 37))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 43, 40))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 43, 37))
var c2: { new <T>(x: T): string; new<T>(x: number): T; }
>c2 : Symbol(c2, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 44, 7))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 44, 19))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 44, 22))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 44, 19))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 44, 41))
>x : Symbol(x, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 44, 44))
>T : Symbol(T, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 44, 41))
var r14 = foo7(1, c); // new any => string; new(x:any, y?:any) => string
>r14 : Symbol(r14, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 45, 7))
>foo7 : Symbol(foo7, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 36, 21))
>c : Symbol(c, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 43, 7))
var r15 = foo7(1, c2); // new any => string; new(x:any, y?:any) => string
>r15 : Symbol(r15, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 46, 7))
>foo7 : Symbol(foo7, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 36, 21))
>c2 : Symbol(c2, Decl(genericCallWithOverloadedConstructorTypedArguments.ts, 44, 7))
}
|