Skip to content

🤖 User test baselines have changed for neverLikeIntersections #36698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/compiler/checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24914,7 +24914,7 @@ namespace ts {
}
}

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

function chooseOverload(candidates: Signature[], relation: Map<RelationComparisonResult>, signatureHelpTrailingComma = false) {
candidatesForArgumentError = undefined;
Expand Down
10 changes: 6 additions & 4 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7017,10 +7017,12 @@ namespace ts {
comments.push(text);
indent += text.length;
}
if (initialMargin) {
if (initialMargin !== undefined) {
// jump straight to saving comments if there is some initial indentation
pushComment(initialMargin);
state = JSDocState.SavingComments;
if (initialMargin !== "") {
pushComment(initialMargin);
}
state = JSDocState.SawAsterisk;
}
let tok = token() as JSDocSyntaxKind;
loop: while (true) {
Expand Down Expand Up @@ -7558,7 +7560,7 @@ namespace ts {
const typeParameter = <TypeParameterDeclaration>createNode(SyntaxKind.TypeParameter);
typeParameter.name = parseJSDocIdentifierName(Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);
finishNode(typeParameter);
skipWhitespace();
skipWhitespaceOrAsterisk();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(SyntaxKind.CommaToken));

Expand Down
6 changes: 5 additions & 1 deletion src/services/jsDoc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@ namespace ts.JsDoc {
* @param position The (character-indexed) position in the file where the check should
* be performed.
*/

export function getDocCommentTemplateAtPosition(newLine: string, sourceFile: SourceFile, position: number): TextInsertion | undefined {
const tokenAtPos = getTokenAtPosition(sourceFile, position);
const existingDocComment = findAncestor(tokenAtPos, isJSDoc);
Expand Down Expand Up @@ -370,6 +369,11 @@ namespace ts.JsDoc {
const parameters = isFunctionLike(be.right) ? be.right.parameters : emptyArray;
return { commentOwner, parameters };
}
case SyntaxKind.PropertyDeclaration:
const init = (commentOwner as PropertyDeclaration).initializer;
if (init && (isFunctionExpression(init) || isArrowFunction(init))) {
return { commentOwner, parameters: init.parameters };
}
}
}

Expand Down
10 changes: 6 additions & 4 deletions src/testRunner/externalCompileRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,11 @@ namespace Harness {
if (!fs.existsSync(submoduleDir)) {
exec("git", ["clone", config.cloneUrl, directoryName], { cwd });
}
exec("git", ["reset", "HEAD", "--hard"], { cwd: submoduleDir });
exec("git", ["clean", "-f"], { cwd: submoduleDir });
exec("git", ["pull", "-f"], { cwd: submoduleDir });
else {
exec("git", ["reset", "HEAD", "--hard"], { cwd: submoduleDir });
exec("git", ["clean", "-f"], { cwd: submoduleDir });
exec("git", ["pull", "-f"], { cwd: submoduleDir });
}

types = config.types;

Expand Down Expand Up @@ -337,4 +339,4 @@ ${stderr.replace(/\r\n/g, "\n")}`;
}
return result;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ baz(array); // Error
baz(["string", 1, true, ...array]); // Error
>baz(["string", 1, true, ...array]) : void
>baz : (x: [string, number, boolean]) => void
>["string", 1, true, ...array] : (string | number | boolean)[]
>["string", 1, true, ...array] : [string, number, true, ...(string | number | boolean)[]]
>"string" : "string"
>1 : 1
>true : true
Expand Down
4 changes: 2 additions & 2 deletions tests/baselines/reference/arrayAssignmentTest3.types
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ class a {


var xx = new a(null, 7, new B());
>xx : any
>new a(null, 7, new B()) : any
>xx : a
>new a(null, 7, new B()) : a
>a : typeof a
>null : null
>7 : 7
Expand Down
8 changes: 1 addition & 7 deletions tests/baselines/reference/baseCheck.errors.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
tests/cases/compiler/baseCheck.ts(9,18): error TS2552: Cannot find name 'loc'. Did you mean 'ELoc'?
tests/cases/compiler/baseCheck.ts(17,53): error TS2554: Expected 2 arguments, but got 1.
tests/cases/compiler/baseCheck.ts(17,59): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/baseCheck.ts(18,62): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/baseCheck.ts(19,59): error TS2345: Argument of type '"hello"' is not assignable to parameter of type 'number'.
tests/cases/compiler/baseCheck.ts(19,68): error TS17009: 'super' must be called before accessing 'this' in the constructor of a derived class.
tests/cases/compiler/baseCheck.ts(22,9): error TS2304: Cannot find name 'x'.
tests/cases/compiler/baseCheck.ts(23,7): error TS2304: Cannot find name 'x'.
tests/cases/compiler/baseCheck.ts(26,9): error TS2304: Cannot find name 'x'.


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

function f() {
if (x<10) {
Expand Down
8 changes: 4 additions & 4 deletions tests/baselines/reference/bigintWithLib.types
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ bigIntArray = new BigInt64Array([1n, 2n, 3n]);
>3n : 3n

bigIntArray = new BigInt64Array([1, 2, 3]); // should error
>bigIntArray = new BigInt64Array([1, 2, 3]) : any
>bigIntArray = new BigInt64Array([1, 2, 3]) : BigInt64Array
>bigIntArray : BigInt64Array
>new BigInt64Array([1, 2, 3]) : any
>new BigInt64Array([1, 2, 3]) : BigInt64Array
>BigInt64Array : BigInt64ArrayConstructor
>[1, 2, 3] : number[]
>1 : 1
Expand Down Expand Up @@ -174,9 +174,9 @@ bigUintArray = new BigUint64Array([1n, 2n, 3n]);
>3n : 3n

bigUintArray = new BigUint64Array([1, 2, 3]); // should error
>bigUintArray = new BigUint64Array([1, 2, 3]) : any
>bigUintArray = new BigUint64Array([1, 2, 3]) : BigUint64Array
>bigUintArray : BigUint64Array
>new BigUint64Array([1, 2, 3]) : any
>new BigUint64Array([1, 2, 3]) : BigUint64Array
>BigUint64Array : BigUint64ArrayConstructor
>[1, 2, 3] : number[]
>1 : 1
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/bigintWithoutLib.types
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ let stringVal: string = bigintVal.toString(); // should not error - bigintVal in
>toString : () => string

stringVal = bigintVal.toString(2); // should error - bigintVal inferred as {}
>stringVal = bigintVal.toString(2) : any
>stringVal = bigintVal.toString(2) : string
>stringVal : string
>bigintVal.toString(2) : string
>bigintVal.toString : () => string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function foo(a: number) {
>foo : { (): void; (): void; }

foo(10); // not ok
>foo(10) : any
>foo(10) : void
>foo : { (): void; (): void; }
>10 : 10
}
Expand All @@ -29,12 +29,12 @@ function foo(a: number) {
>foo : { (): void; (): void; }

foo(10); // not ok
>foo(10) : any
>foo(10) : void
>foo : { (): void; (): void; }
>10 : 10
}
foo(10); // not ok
>foo(10) : any
>foo(10) : void
>foo : { (): void; (): void; }
>10 : 10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ function foo(a: number) {
>foo : { (): void; (): void; }

foo(10); // not ok
>foo(10) : any
>foo(10) : void
>foo : { (): void; (): void; }
>10 : 10
}
Expand All @@ -29,12 +29,12 @@ function foo(a: number) {
>foo : { (): void; (): void; }

foo(10);// not ok
>foo(10) : any
>foo(10) : void
>foo : { (): void; (): void; }
>10 : 10
}
foo(10); // not ok
>foo(10) : any
>foo(10) : void
>foo : { (): void; (): void; }
>10 : 10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ function f<T, U>(x: T, y: U): T { return null; }
>null : null

var r1 = f<number>(1, '');
>r1 : any
>f<number>(1, '') : any
>r1 : number
>f<number>(1, '') : number
>f : <T, U>(x: T, y: U) => T
>1 : 1
>'' : ""

var r1b = f<number, string, number>(1, '');
>r1b : any
>f<number, string, number>(1, '') : any
>r1b : number
>f<number, string, number>(1, '') : number
>f : <T, U>(x: T, y: U) => T
>1 : 1
>'' : ""
Expand All @@ -30,15 +30,15 @@ var f2 = <T, U>(x: T, y: U): T => { return null; }
>null : null

var r2 = f2<number>(1, '');
>r2 : any
>f2<number>(1, '') : any
>r2 : number
>f2<number>(1, '') : number
>f2 : <T, U>(x: T, y: U) => T
>1 : 1
>'' : ""

var r2b = f2<number, string, number>(1, '');
>r2b : any
>f2<number, string, number>(1, '') : any
>r2b : number
>f2<number, string, number>(1, '') : number
>f2 : <T, U>(x: T, y: U) => T
>1 : 1
>'' : ""
Expand All @@ -49,15 +49,15 @@ var f3: { <T, U>(x: T, y: U): T; }
>y : U

var r3 = f3<number>(1, '');
>r3 : any
>f3<number>(1, '') : any
>r3 : number
>f3<number>(1, '') : number
>f3 : <T, U>(x: T, y: U) => T
>1 : 1
>'' : ""

var r3b = f3<number, string, number>(1, '');
>r3b : any
>f3<number, string, number>(1, '') : any
>r3b : number
>f3<number, string, number>(1, '') : number
>f3 : <T, U>(x: T, y: U) => T
>1 : 1
>'' : ""
Expand All @@ -75,8 +75,8 @@ class C {
}
}
var r4 = (new C()).f<number>(1, '');
>r4 : any
>(new C()).f<number>(1, '') : any
>r4 : number
>(new C()).f<number>(1, '') : number
>(new C()).f : <T, U>(x: T, y: U) => T
>(new C()) : C
>new C() : C
Expand All @@ -86,8 +86,8 @@ var r4 = (new C()).f<number>(1, '');
>'' : ""

var r4b = (new C()).f<number, string, number>(1, '');
>r4b : any
>(new C()).f<number, string, number>(1, '') : any
>r4b : number
>(new C()).f<number, string, number>(1, '') : number
>(new C()).f : <T, U>(x: T, y: U) => T
>(new C()) : C
>new C() : C
Expand All @@ -106,17 +106,17 @@ var i: I;
>i : I

var r5 = i.f<number>(1, '');
>r5 : any
>i.f<number>(1, '') : any
>r5 : number
>i.f<number>(1, '') : number
>i.f : <T, U>(x: T, y: U) => T
>i : I
>f : <T, U>(x: T, y: U) => T
>1 : 1
>'' : ""

var r5b = i.f<number, string, number>(1, '');
>r5b : any
>i.f<number, string, number>(1, '') : any
>r5b : number
>i.f<number, string, number>(1, '') : number
>i.f : <T, U>(x: T, y: U) => T
>i : I
>f : <T, U>(x: T, y: U) => T
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function foo() {
>"expects boolean instead of string" : "expects boolean instead of string"

test(true); // should error - string expected
>test(true) : any
>test(true) : void
>test : I1<string>
>true : true
}
8 changes: 4 additions & 4 deletions tests/baselines/reference/callWithMissingVoid.types
Original file line number Diff line number Diff line change
Expand Up @@ -99,23 +99,23 @@ new MyPromise<void | number>(resolve => resolve()); // no error
new MyPromise<any>(resolve => resolve()); // error, `any` arguments cannot be omitted
>new MyPromise<any>(resolve => resolve()) : MyPromise<any>
>MyPromise : typeof MyPromise
>resolve => resolve() : (resolve: (value: any) => void) => any
>resolve => resolve() : (resolve: (value: any) => void) => void
>resolve : (value: any) => void
>resolve() : void
>resolve : (value: any) => void

new MyPromise<unknown>(resolve => resolve()); // error, `unknown` arguments cannot be omitted
>new MyPromise<unknown>(resolve => resolve()) : MyPromise<unknown>
>MyPromise : typeof MyPromise
>resolve => resolve() : (resolve: (value: unknown) => void) => any
>resolve => resolve() : (resolve: (value: unknown) => void) => void
>resolve : (value: unknown) => void
>resolve() : void
>resolve : (value: unknown) => void

new MyPromise<never>(resolve => resolve()); // error, `never` arguments cannot be omitted
>new MyPromise<never>(resolve => resolve()) : MyPromise<never>
>MyPromise : typeof MyPromise
>resolve => resolve() : (resolve: (value: never) => void) => any
>resolve => resolve() : (resolve: (value: never) => void) => void
>resolve : (value: never) => void
>resolve() : void
>resolve : (value: never) => void
Expand Down Expand Up @@ -234,7 +234,7 @@ declare function call<TS extends unknown[]>(
>args : TS

call((x: number, y: number) => x + y) // error
>call((x: number, y: number) => x + y) : any
>call((x: number, y: number) => x + y) : void
>call : <TS extends unknown[]>(handler: (...args: TS) => unknown, ...args: TS) => void
>(x: number, y: number) => x + y : (x: number, y: number) => number
>x : number
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ function f<T, U>() { }
>f : <T, U>() => void

f<number>();
>f<number>() : any
>f<number>() : void
>f : <T, U>() => void

f<number, string>();
>f<number, string>() : void
>f : <T, U>() => void

f<number, string, number>();
>f<number, string, number>() : any
>f<number, string, number>() : void
>f : <T, U>() => void

Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,64): error TS2741: Property 'z' is missing in type 'B' but required in type 'C'.
tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts(19,81): error TS2739: Type 'A' is missing the following properties from type 'C': z, y


==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (1 errors) ====
==== tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts (2 errors) ====
class Chain<T extends A> {
constructor(public value: T) { }
then<S extends T>(cb: (x: T) => S): Chain<S> {
Expand All @@ -24,4 +25,7 @@ tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParamete
~~~~~
!!! error TS2741: Property 'z' is missing in type 'B' but required in type 'C'.
!!! related TS2728 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:15:5: 'z' is declared here.
!!! related TS6502 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:3:27: The expected type comes from the return type of this signature.
~~~~~
!!! error TS2739: Type 'A' is missing the following properties from type 'C': z, y
!!! related TS6502 tests/cases/compiler/chainedCallsWithTypeParameterConstrainedToOtherTypeParameter.ts:3:27: The expected type comes from the return type of this signature.
Loading