Skip to content

Commit e6212d7

Browse files
author
Andy Hanson
committed
Always call getCandidateForOverloadFailure
1 parent b059135 commit e6212d7

File tree

256 files changed

+1544
-1297
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+1544
-1297
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19952,7 +19952,7 @@ namespace ts {
1995219952
}
1995319953
}
1995419954

19955-
return produceDiagnostics || !args ? resolveErrorCall(node) : getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
19955+
return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray);
1995619956

1995719957
function chooseOverload(candidates: Signature[], relation: Map<RelationComparisonResult>, signatureHelpTrailingComma = false) {
1995819958
candidateForArgumentError = undefined;

tests/baselines/reference/argumentExpressionContextualTyping.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ baz(array); // Error
122122
baz(["string", 1, true, ...array]); // Error
123123
>baz(["string", 1, true, ...array]) : void
124124
>baz : (x: [string, number, boolean]) => void
125-
>["string", 1, true, ...array] : (string | number | boolean)[]
125+
>["string", 1, true, ...array] : [string, number, true, ...(string | number | boolean)[]]
126126
>"string" : "string"
127127
>1 : 1
128128
>true : true

tests/baselines/reference/arrayAssignmentTest3.types

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ class a {
1717

1818

1919
var xx = new a(null, 7, new B());
20-
>xx : any
21-
>new a(null, 7, new B()) : any
20+
>xx : a
21+
>new a(null, 7, new B()) : a
2222
>a : typeof a
2323
>null : null
2424
>7 : 7

tests/baselines/reference/baseCheck.errors.txt

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
tests/cases/compiler/baseCheck.ts(9,18): error TS2552: Cannot find name 'loc'. Did you mean 'ELoc'?
22
tests/cases/compiler/baseCheck.ts(17,53): error TS2554: Expected 2 arguments, but got 1.
3-
tests/cases/compiler/baseCheck.ts(17,59): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
43
tests/cases/compiler/baseCheck.ts(18,62): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
54
tests/cases/compiler/baseCheck.ts(19,59): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
6-
tests/cases/compiler/baseCheck.ts(19,68): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
75
tests/cases/compiler/baseCheck.ts(22,9): error TS2304: Cannot find name 'x'.
86
tests/cases/compiler/baseCheck.ts(23,7): error TS2304: Cannot find name 'x'.
97
tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.
108

119

12-
==== tests/cases/compiler/baseCheck.ts (9 errors) ====
10+
==== tests/cases/compiler/baseCheck.ts (7 errors) ====
1311
class C { constructor(x: number, y: number) { } }
1412
class ELoc extends C {
1513
constructor(x: number) {
@@ -33,16 +31,12 @@ tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.
3331
~~~~~~~~~~~~~
3432
!!! error TS2554: Expected 2 arguments, but got 1.
3533
!!! related TS6210 tests/cases/compiler/baseCheck.ts:1:34: An argument for 'y' was not provided.
36-
~~~~
37-
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
3834
class E extends C { constructor(public z: number) { super(0, this.z) } }
3935
~~~~
4036
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
4137
class F extends C { constructor(public z: number) { super("hello", this.z) } } // first param type
4238
~~~~~~~
4339
!!! error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
44-
~~~~
45-
!!! error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
4640

4741
function f() {
4842
if (x<10) {

tests/baselines/reference/bigintWithLib.types

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ bigIntArray = new BigInt64Array([1n, 2n, 3n]);
9494
>3n : 3n
9595

9696
bigIntArray = new BigInt64Array([1, 2, 3]); // should error
97-
>bigIntArray = new BigInt64Array([1, 2, 3]) : any
97+
>bigIntArray = new BigInt64Array([1, 2, 3]) : BigInt64Array
9898
>bigIntArray : BigInt64Array
99-
>new BigInt64Array([1, 2, 3]) : any
99+
>new BigInt64Array([1, 2, 3]) : BigInt64Array
100100
>BigInt64Array : BigInt64ArrayConstructor
101101
>[1, 2, 3] : number[]
102102
>1 : 1
@@ -174,9 +174,9 @@ bigUintArray = new BigUint64Array([1n, 2n, 3n]);
174174
>3n : 3n
175175

176176
bigUintArray = new BigUint64Array([1, 2, 3]); // should error
177-
>bigUintArray = new BigUint64Array([1, 2, 3]) : any
177+
>bigUintArray = new BigUint64Array([1, 2, 3]) : BigUint64Array
178178
>bigUintArray : BigUint64Array
179-
>new BigUint64Array([1, 2, 3]) : any
179+
>new BigUint64Array([1, 2, 3]) : BigUint64Array
180180
>BigUint64Array : BigUint64ArrayConstructor
181181
>[1, 2, 3] : number[]
182182
>1 : 1

tests/baselines/reference/bigintWithoutLib.types

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ let stringVal: string = bigintVal.toString(); // should not error - bigintVal in
5656
>toString : () => string
5757

5858
stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {}
59-
>stringVal = bigintVal.toString(2) : any
59+
>stringVal = bigintVal.toString(2) : string
6060
>stringVal : string
6161
>bigintVal.toString(2) : string
6262
>bigintVal.toString : () => string

tests/baselines/reference/blockScopedSameNameFunctionDeclarationES5.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function foo(a: number) {
1616
>foo : { (): void; (): void; }
1717

1818
foo(10); // not ok
19-
>foo(10) : any
19+
>foo(10) : void
2020
>foo : { (): void; (): void; }
2121
>10 : 10
2222
}
@@ -29,12 +29,12 @@ function foo(a: number) {
2929
>foo : { (): void; (): void; }
3030

3131
foo(10); // not ok
32-
>foo(10) : any
32+
>foo(10) : void
3333
>foo : { (): void; (): void; }
3434
>10 : 10
3535
}
3636
foo(10); // not ok
37-
>foo(10) : any
37+
>foo(10) : void
3838
>foo : { (): void; (): void; }
3939
>10 : 10
4040

tests/baselines/reference/blockScopedSameNameFunctionDeclarationES6.types

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function foo(a: number) {
1616
>foo : { (): void; (): void; }
1717

1818
foo(10); // not ok
19-
>foo(10) : any
19+
>foo(10) : void
2020
>foo : { (): void; (): void; }
2121
>10 : 10
2222
}
@@ -29,12 +29,12 @@ function foo(a: number) {
2929
>foo : { (): void; (): void; }
3030

3131
foo(10);// not ok
32-
>foo(10) : any
32+
>foo(10) : void
3333
>foo : { (): void; (): void; }
3434
>10 : 10
3535
}
3636
foo(10); // not ok
37-
>foo(10) : any
37+
>foo(10) : void
3838
>foo : { (): void; (): void; }
3939
>10 : 10
4040

tests/baselines/reference/callGenericFunctionWithIncorrectNumberOfTypeArguments.types

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ function f<T, U>(x: T, y: U): T { return null; }
99
>null : null
1010

1111
var r1 = f<number>(1, '');
12-
>r1 : any
13-
>f<number>(1, '') : any
12+
>r1 : number
13+
>f<number>(1, '') : number
1414
>f : <T, U>(x: T, y: U) => T
1515
>1 : 1
1616
>'' : ""
1717

1818
var r1b = f<number, string, number>(1, '');
19-
>r1b : any
20-
>f<number, string, number>(1, '') : any
19+
>r1b : number
20+
>f<number, string, number>(1, '') : number
2121
>f : <T, U>(x: T, y: U) => T
2222
>1 : 1
2323
>'' : ""
@@ -30,15 +30,15 @@ var f2 = <T, U>(x: T, y: U): T => { return null; }
3030
>null : null
3131

3232
var r2 = f2<number>(1, '');
33-
>r2 : any
34-
>f2<number>(1, '') : any
33+
>r2 : number
34+
>f2<number>(1, '') : number
3535
>f2 : <T, U>(x: T, y: U) => T
3636
>1 : 1
3737
>'' : ""
3838

3939
var r2b = f2<number, string, number>(1, '');
40-
>r2b : any
41-
>f2<number, string, number>(1, '') : any
40+
>r2b : number
41+
>f2<number, string, number>(1, '') : number
4242
>f2 : <T, U>(x: T, y: U) => T
4343
>1 : 1
4444
>'' : ""
@@ -49,15 +49,15 @@ var f3: { <T, U>(x: T, y: U): T; }
4949
>y : U
5050

5151
var r3 = f3<number>(1, '');
52-
>r3 : any
53-
>f3<number>(1, '') : any
52+
>r3 : number
53+
>f3<number>(1, '') : number
5454
>f3 : <T, U>(x: T, y: U) => T
5555
>1 : 1
5656
>'' : ""
5757

5858
var r3b = f3<number, string, number>(1, '');
59-
>r3b : any
60-
>f3<number, string, number>(1, '') : any
59+
>r3b : number
60+
>f3<number, string, number>(1, '') : number
6161
>f3 : <T, U>(x: T, y: U) => T
6262
>1 : 1
6363
>'' : ""
@@ -75,8 +75,8 @@ class C {
7575
}
7676
}
7777
var r4 = (new C()).f<number>(1, '');
78-
>r4 : any
79-
>(new C()).f<number>(1, '') : any
78+
>r4 : number
79+
>(new C()).f<number>(1, '') : number
8080
>(new C()).f : <T, U>(x: T, y: U) => T
8181
>(new C()) : C
8282
>new C() : C
@@ -86,8 +86,8 @@ var r4 = (new C()).f<number>(1, '');
8686
>'' : ""
8787

8888
var r4b = (new C()).f<number, string, number>(1, '');
89-
>r4b : any
90-
>(new C()).f<number, string, number>(1, '') : any
89+
>r4b : number
90+
>(new C()).f<number, string, number>(1, '') : number
9191
>(new C()).f : <T, U>(x: T, y: U) => T
9292
>(new C()) : C
9393
>new C() : C
@@ -106,17 +106,17 @@ var i: I;
106106
>i : I
107107

108108
var r5 = i.f<number>(1, '');
109-
>r5 : any
110-
>i.f<number>(1, '') : any
109+
>r5 : number
110+
>i.f<number>(1, '') : number
111111
>i.f : <T, U>(x: T, y: U) => T
112112
>i : I
113113
>f : <T, U>(x: T, y: U) => T
114114
>1 : 1
115115
>'' : ""
116116

117117
var r5b = i.f<number, string, number>(1, '');
118-
>r5b : any
119-
>i.f<number, string, number>(1, '') : any
118+
>r5b : number
119+
>i.f<number, string, number>(1, '') : number
120120
>i.f : <T, U>(x: T, y: U) => T
121121
>i : I
122122
>f : <T, U>(x: T, y: U) => T

tests/baselines/reference/callOnInstance.errors.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
tests/cases/compiler/callOnInstance.ts(1,18): error TS2300: Duplicate identifier 'D'.
22
tests/cases/compiler/callOnInstance.ts(3,15): error TS2300: Duplicate identifier 'D'.
3+
tests/cases/compiler/callOnInstance.ts(7,19): error TS2350: Only a void function can be called with the 'new' keyword.
34
tests/cases/compiler/callOnInstance.ts(7,19): error TS2554: Expected 0 arguments, but got 1.
45
tests/cases/compiler/callOnInstance.ts(10,1): error TS2349: Cannot invoke an expression whose type lacks a call signature. Type 'C' has no compatible call signatures.
56

67

7-
==== tests/cases/compiler/callOnInstance.ts (4 errors) ====
8+
==== tests/cases/compiler/callOnInstance.ts (5 errors) ====
89
declare function D(): string; // error
910
~
1011
!!! error TS2300: Duplicate identifier 'D'.
@@ -17,6 +18,8 @@ tests/cases/compiler/callOnInstance.ts(10,1): error TS2349: Cannot invoke an exp
1718

1819
var s2: string = (new D(1))();
1920
~~~~~~~~
21+
!!! error TS2350: Only a void function can be called with the 'new' keyword.
22+
~~~~~~~~
2023
!!! error TS2554: Expected 0 arguments, but got 1.
2124

2225
declare class C { constructor(value: number); }

0 commit comments

Comments
 (0)