Skip to content

Commit a46df50

Browse files
committed
Merge branch 'master' of https://github.com/Microsoft/TypeScript into feature/36048
2 parents 409b427 + fa3173f commit a46df50

File tree

281 files changed

+1771
-1430
lines changed

Some content is hidden

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

281 files changed

+1771
-1430
lines changed

src/compiler/checker.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24886,7 +24886,7 @@ namespace ts {
2488624886
}
2488724887
}
2488824888

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

2489124891
function chooseOverload(candidates: Signature[], relation: Map<RelationComparisonResult>, signatureHelpTrailingComma = false) {
2489224892
candidatesForArgumentError = undefined;

src/compiler/parser.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7017,10 +7017,12 @@ namespace ts {
70177017
comments.push(text);
70187018
indent += text.length;
70197019
}
7020-
if (initialMargin) {
7020+
if (initialMargin !== undefined) {
70217021
// jump straight to saving comments if there is some initial indentation
7022-
pushComment(initialMargin);
7023-
state = JSDocState.SavingComments;
7022+
if (initialMargin !== "") {
7023+
pushComment(initialMargin);
7024+
}
7025+
state = JSDocState.SawAsterisk;
70247026
}
70257027
let tok = token() as JSDocSyntaxKind;
70267028
loop: while (true) {
@@ -7558,7 +7560,7 @@ namespace ts {
75587560
const typeParameter = <TypeParameterDeclaration>createNode(SyntaxKind.TypeParameter);
75597561
typeParameter.name = parseJSDocIdentifierName(Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);
75607562
finishNode(typeParameter);
7561-
skipWhitespace();
7563+
skipWhitespaceOrAsterisk();
75627564
typeParameters.push(typeParameter);
75637565
} while (parseOptionalJsdoc(SyntaxKind.CommaToken));
75647566

src/testRunner/externalCompileRunner.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ namespace Harness {
5858
if (!fs.existsSync(submoduleDir)) {
5959
exec("git", ["clone", config.cloneUrl, directoryName], { cwd });
6060
}
61-
exec("git", ["reset", "HEAD", "--hard"], { cwd: submoduleDir });
62-
exec("git", ["clean", "-f"], { cwd: submoduleDir });
63-
exec("git", ["pull", "-f"], { cwd: submoduleDir });
61+
else {
62+
exec("git", ["reset", "HEAD", "--hard"], { cwd: submoduleDir });
63+
exec("git", ["clean", "-f"], { cwd: submoduleDir });
64+
exec("git", ["pull", "-f"], { cwd: submoduleDir });
65+
}
6466

6567
types = config.types;
6668

@@ -337,4 +339,4 @@ ${stderr.replace(/\r\n/g, "\n")}`;
337339
}
338340
return result;
339341
}
340-
}
342+
}

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

0 commit comments

Comments
 (0)