Skip to content

Commit 47bbc95

Browse files
committed
Convert related spans to message chains
1 parent ba9d8e2 commit 47bbc95

File tree

37 files changed

+928
-464
lines changed

37 files changed

+928
-464
lines changed

src/compiler/checker.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21655,8 +21655,10 @@ namespace ts {
2165521655
i++;
2165621656
}
2165721657

21658-
const related = max > 1 ? allDiagnostics[minIndex] : flatten(allDiagnostics);
21659-
diagnostics.add(createDiagnosticForNodeFromMessageChain(node, chainDiagnosticMessages(undefined, Diagnostics.No_overload_matches_this_call), related));
21658+
const related = map(
21659+
max > 1 ? allDiagnostics[minIndex] : flatten(allDiagnostics),
21660+
d => typeof d.messageText === 'string' ? (d as DiagnosticMessageChain) : d.messageText);
21661+
diagnostics.add(createDiagnosticForNodeFromMessageChain(node, chainDiagnosticMessages(related, Diagnostics.No_overload_matches_this_call)));
2166021662
}
2166121663
}
2166221664
else if (candidateForArgumentArityError) {

tests/baselines/reference/bigintWithLib.errors.txt

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,28 @@
11
tests/cases/compiler/bigintWithLib.ts(4,1): error TS2350: Only a void function can be called with the 'new' keyword.
22
tests/cases/compiler/bigintWithLib.ts(16,15): error TS2755: No overload matches this call.
3+
Overload 1 of 3, '(length?: number): BigInt64Array', gave the following error.
4+
Argument of type 'number[]' is not assignable to parameter of type 'number'.
5+
Overload 2 of 3, '(array: Iterable<bigint>): BigInt64Array', gave the following error.
6+
Argument of type 'number[]' is not assignable to parameter of type 'Iterable<bigint>'.
7+
Types of property '[Symbol.iterator]' are incompatible.
8+
Type '() => IterableIterator<number>' is not assignable to type '() => Iterator<bigint>'.
9+
Type 'IterableIterator<number>' is not assignable to type 'Iterator<bigint>'.
10+
Types of property 'next' are incompatible.
11+
Type '(value?: any) => IteratorResult<number>' is not assignable to type '(value?: any) => IteratorResult<bigint>'.
12+
Type 'IteratorResult<number>' is not assignable to type 'IteratorResult<bigint>'.
13+
Type 'number' is not assignable to type 'bigint'.
14+
Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigInt64Array', gave the following error.
15+
Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
16+
Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag]
317
tests/cases/compiler/bigintWithLib.ts(21,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
418
tests/cases/compiler/bigintWithLib.ts(28,16): error TS2755: No overload matches this call.
19+
Overload 1 of 3, '(length?: number): BigUint64Array', gave the following error.
20+
Argument of type 'number[]' is not assignable to parameter of type 'number'.
21+
Overload 2 of 3, '(array: Iterable<bigint>): BigUint64Array', gave the following error.
22+
Argument of type 'number[]' is not assignable to parameter of type 'Iterable<bigint>'.
23+
Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigUint64Array', gave the following error.
24+
Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
25+
Type 'number[]' is not assignable to type 'SharedArrayBuffer'.
526
tests/cases/compiler/bigintWithLib.ts(33,13): error TS2540: Cannot assign to 'length' because it is a read-only property.
627
tests/cases/compiler/bigintWithLib.ts(40,25): error TS2345: Argument of type '-1' is not assignable to parameter of type 'bigint'.
728
tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '123' is not assignable to parameter of type 'bigint'.
@@ -28,20 +49,20 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12
2849
bigIntArray = new BigInt64Array([1, 2, 3]); // should error
2950
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3051
!!! error TS2755: No overload matches this call.
31-
!!! related TS2760 tests/cases/compiler/bigintWithLib.ts:16:33: Overload 1 of 3, '(length?: number): BigInt64Array', gave the following error.
32-
Argument of type 'number[]' is not assignable to parameter of type 'number'.
33-
!!! related TS2760 tests/cases/compiler/bigintWithLib.ts:16:33: Overload 2 of 3, '(array: Iterable<bigint>): BigInt64Array', gave the following error.
34-
Argument of type 'number[]' is not assignable to parameter of type 'Iterable<bigint>'.
35-
Types of property '[Symbol.iterator]' are incompatible.
36-
Type '() => IterableIterator<number>' is not assignable to type '() => Iterator<bigint>'.
37-
Type 'IterableIterator<number>' is not assignable to type 'Iterator<bigint>'.
38-
Types of property 'next' are incompatible.
39-
Type '(value?: any) => IteratorResult<number>' is not assignable to type '(value?: any) => IteratorResult<bigint>'.
40-
Type 'IteratorResult<number>' is not assignable to type 'IteratorResult<bigint>'.
41-
Type 'number' is not assignable to type 'bigint'.
42-
!!! related TS2760 tests/cases/compiler/bigintWithLib.ts:16:33: Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigInt64Array', gave the following error.
43-
Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
44-
Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag]
52+
!!! error TS2755: Overload 1 of 3, '(length?: number): BigInt64Array', gave the following error.
53+
!!! error TS2755: Argument of type 'number[]' is not assignable to parameter of type 'number'.
54+
!!! error TS2755: Overload 2 of 3, '(array: Iterable<bigint>): BigInt64Array', gave the following error.
55+
!!! error TS2755: Argument of type 'number[]' is not assignable to parameter of type 'Iterable<bigint>'.
56+
!!! error TS2755: Types of property '[Symbol.iterator]' are incompatible.
57+
!!! error TS2755: Type '() => IterableIterator<number>' is not assignable to type '() => Iterator<bigint>'.
58+
!!! error TS2755: Type 'IterableIterator<number>' is not assignable to type 'Iterator<bigint>'.
59+
!!! error TS2755: Types of property 'next' are incompatible.
60+
!!! error TS2755: Type '(value?: any) => IteratorResult<number>' is not assignable to type '(value?: any) => IteratorResult<bigint>'.
61+
!!! error TS2755: Type 'IteratorResult<number>' is not assignable to type 'IteratorResult<bigint>'.
62+
!!! error TS2755: Type 'number' is not assignable to type 'bigint'.
63+
!!! error TS2755: Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigInt64Array', gave the following error.
64+
!!! error TS2755: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
65+
!!! error TS2755: Type 'number[]' is missing the following properties from type 'SharedArrayBuffer': byteLength, [Symbol.species], [Symbol.toStringTag]
4566
bigIntArray = new BigInt64Array(new ArrayBuffer(80));
4667
bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8);
4768
bigIntArray = new BigInt64Array(new ArrayBuffer(80), 8, 3);
@@ -58,13 +79,13 @@ tests/cases/compiler/bigintWithLib.ts(43,26): error TS2345: Argument of type '12
5879
bigUintArray = new BigUint64Array([1, 2, 3]); // should error
5980
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6081
!!! error TS2755: No overload matches this call.
61-
!!! related TS2760 tests/cases/compiler/bigintWithLib.ts:28:35: Overload 1 of 3, '(length?: number): BigUint64Array', gave the following error.
62-
Argument of type 'number[]' is not assignable to parameter of type 'number'.
63-
!!! related TS2760 tests/cases/compiler/bigintWithLib.ts:28:35: Overload 2 of 3, '(array: Iterable<bigint>): BigUint64Array', gave the following error.
64-
Argument of type 'number[]' is not assignable to parameter of type 'Iterable<bigint>'.
65-
!!! related TS2760 tests/cases/compiler/bigintWithLib.ts:28:35: Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigUint64Array', gave the following error.
66-
Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
67-
Type 'number[]' is not assignable to type 'SharedArrayBuffer'.
82+
!!! error TS2755: Overload 1 of 3, '(length?: number): BigUint64Array', gave the following error.
83+
!!! error TS2755: Argument of type 'number[]' is not assignable to parameter of type 'number'.
84+
!!! error TS2755: Overload 2 of 3, '(array: Iterable<bigint>): BigUint64Array', gave the following error.
85+
!!! error TS2755: Argument of type 'number[]' is not assignable to parameter of type 'Iterable<bigint>'.
86+
!!! error TS2755: Overload 3 of 3, '(buffer: ArrayBuffer | SharedArrayBuffer, byteOffset?: number, length?: number): BigUint64Array', gave the following error.
87+
!!! error TS2755: Argument of type 'number[]' is not assignable to parameter of type 'ArrayBuffer | SharedArrayBuffer'.
88+
!!! error TS2755: Type 'number[]' is not assignable to type 'SharedArrayBuffer'.
6889
bigUintArray = new BigUint64Array(new ArrayBuffer(80));
6990
bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8);
7091
bigUintArray = new BigUint64Array(new ArrayBuffer(80), 8, 3);

tests/baselines/reference/constructorOverloads1.errors.txt

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,15 @@ tests/cases/compiler/constructorOverloads1.ts(3,5): error TS2392: Multiple const
33
tests/cases/compiler/constructorOverloads1.ts(4,5): error TS2392: Multiple constructor implementations are not allowed.
44
tests/cases/compiler/constructorOverloads1.ts(7,5): error TS2392: Multiple constructor implementations are not allowed.
55
tests/cases/compiler/constructorOverloads1.ts(16,10): error TS2755: No overload matches this call.
6+
Overload 1 of 2, '(s: string): Foo', gave the following error.
7+
Argument of type 'Foo' is not assignable to parameter of type 'string'.
8+
Overload 2 of 2, '(n: number): Foo', gave the following error.
9+
Argument of type 'Foo' is not assignable to parameter of type 'number'.
610
tests/cases/compiler/constructorOverloads1.ts(17,10): error TS2755: No overload matches this call.
11+
Overload 1 of 2, '(s: string): Foo', gave the following error.
12+
Argument of type 'any[]' is not assignable to parameter of type 'string'.
13+
Overload 2 of 2, '(n: number): Foo', gave the following error.
14+
Argument of type 'any[]' is not assignable to parameter of type 'number'.
715

816

917
==== tests/cases/compiler/constructorOverloads1.ts (6 errors) ====
@@ -37,17 +45,17 @@ tests/cases/compiler/constructorOverloads1.ts(17,10): error TS2755: No overload
3745
var f3 = new Foo(f1);
3846
~~~~~~~~~~~
3947
!!! error TS2755: No overload matches this call.
40-
!!! related TS2760 tests/cases/compiler/constructorOverloads1.ts:16:18: Overload 1 of 2, '(s: string): Foo', gave the following error.
41-
Argument of type 'Foo' is not assignable to parameter of type 'string'.
42-
!!! related TS2760 tests/cases/compiler/constructorOverloads1.ts:16:18: Overload 2 of 2, '(n: number): Foo', gave the following error.
43-
Argument of type 'Foo' is not assignable to parameter of type 'number'.
48+
!!! error TS2755: Overload 1 of 2, '(s: string): Foo', gave the following error.
49+
!!! error TS2755: Argument of type 'Foo' is not assignable to parameter of type 'string'.
50+
!!! error TS2755: Overload 2 of 2, '(n: number): Foo', gave the following error.
51+
!!! error TS2755: Argument of type 'Foo' is not assignable to parameter of type 'number'.
4452
var f4 = new Foo([f1,f2,f3]);
4553
~~~~~~~~~~~~~~~~~~~
4654
!!! error TS2755: No overload matches this call.
47-
!!! related TS2760 tests/cases/compiler/constructorOverloads1.ts:17:18: Overload 1 of 2, '(s: string): Foo', gave the following error.
48-
Argument of type 'any[]' is not assignable to parameter of type 'string'.
49-
!!! related TS2760 tests/cases/compiler/constructorOverloads1.ts:17:18: Overload 2 of 2, '(n: number): Foo', gave the following error.
50-
Argument of type 'any[]' is not assignable to parameter of type 'number'.
55+
!!! error TS2755: Overload 1 of 2, '(s: string): Foo', gave the following error.
56+
!!! error TS2755: Argument of type 'any[]' is not assignable to parameter of type 'string'.
57+
!!! error TS2755: Overload 2 of 2, '(n: number): Foo', gave the following error.
58+
!!! error TS2755: Argument of type 'any[]' is not assignable to parameter of type 'number'.
5159

5260
f1.bar1();
5361
f1.bar2();

0 commit comments

Comments
 (0)