diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index c003090aaf45d..d6201ced0763c 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -24899,7 +24899,9 @@ namespace ts { } } - return getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray); + const resultSignature = getCandidateForOverloadFailure(node, candidates, args, !!candidatesOutArray); + resolveErrorCall(node); // Ensure that even if there's an arity error, subexpressions are checked + return resultSignature; function chooseOverload(candidates: Signature[], relation: Map, signatureHelpTrailingComma = false) { candidatesForArgumentError = undefined; diff --git a/tests/baselines/reference/baseCheck.errors.txt b/tests/baselines/reference/baseCheck.errors.txt index 634ce2b66a647..67358a1033834 100644 --- a/tests/baselines/reference/baseCheck.errors.txt +++ b/tests/baselines/reference/baseCheck.errors.txt @@ -1,13 +1,15 @@ 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 (7 errors) ==== +==== tests/cases/compiler/baseCheck.ts (9 errors) ==== class C { constructor(x: number, y: number) { } } class ELoc extends C { constructor(x: number) { @@ -31,12 +33,16 @@ 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) { diff --git a/tests/baselines/reference/grammarAmbiguities1.errors.txt b/tests/baselines/reference/grammarAmbiguities1.errors.txt index bc624d7bcdf38..cb3037bd72a29 100644 --- a/tests/baselines/reference/grammarAmbiguities1.errors.txt +++ b/tests/baselines/reference/grammarAmbiguities1.errors.txt @@ -1,8 +1,12 @@ +tests/cases/compiler/grammarAmbiguities1.ts(8,3): error TS2365: Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. +tests/cases/compiler/grammarAmbiguities1.ts(8,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'. tests/cases/compiler/grammarAmbiguities1.ts(8,10): error TS2554: Expected 1 arguments, but got 2. +tests/cases/compiler/grammarAmbiguities1.ts(9,3): error TS2365: Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. +tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'. tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2554: Expected 1 arguments, but got 2. -==== tests/cases/compiler/grammarAmbiguities1.ts (2 errors) ==== +==== tests/cases/compiler/grammarAmbiguities1.ts (6 errors) ==== class A { foo() { } } class B { bar() { }} function f(x) { return x; } @@ -11,9 +15,17 @@ tests/cases/compiler/grammarAmbiguities1.ts(9,10): error TS2554: Expected 1 argu f(g(7)); f(g < A, B > 7); + ~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. + ~~~~~ +!!! error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'. ~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. f(g < A, B > +(7)); + ~~~~~ +!!! error TS2365: Operator '<' cannot be applied to types '(x: any) => any' and 'typeof A'. + ~~~~~~~~ +!!! error TS2365: Operator '>' cannot be applied to types 'typeof B' and 'number'. ~~~~~~~~ !!! error TS2554: Expected 1 arguments, but got 2. \ No newline at end of file diff --git a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.symbols b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.symbols index 76e53d7485959..ff8312a0e716b 100644 --- a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.symbols +++ b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.symbols @@ -57,17 +57,13 @@ var r7 = map([1, ""], (x) => x.toString()); // error >r7 : Symbol(r7, Decl(mismatchedExplicitTypeParameterAndArgumentType.ts, 9, 3)) >map : Symbol(map, Decl(mismatchedExplicitTypeParameterAndArgumentType.ts, 0, 0)) >x : Symbol(x, Decl(mismatchedExplicitTypeParameterAndArgumentType.ts, 9, 39)) ->x.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(mismatchedExplicitTypeParameterAndArgumentType.ts, 9, 39)) ->toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) var r7b = map([1, ""], (x) => x.toString()); // error >r7b : Symbol(r7b, Decl(mismatchedExplicitTypeParameterAndArgumentType.ts, 10, 3)) >map : Symbol(map, Decl(mismatchedExplicitTypeParameterAndArgumentType.ts, 0, 0)) >x : Symbol(x, Decl(mismatchedExplicitTypeParameterAndArgumentType.ts, 10, 32)) ->x.toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) >x : Symbol(x, Decl(mismatchedExplicitTypeParameterAndArgumentType.ts, 10, 32)) ->toString : Symbol(Number.toString, Decl(lib.es5.d.ts, --, --)) var r8 = map([1, ""], (x) => x.toString()); >r8 : Symbol(r8, Decl(mismatchedExplicitTypeParameterAndArgumentType.ts, 11, 3)) diff --git a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.types b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.types index 6adf391870603..06be2f2149686 100644 --- a/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.types +++ b/tests/baselines/reference/mismatchedExplicitTypeParameterAndArgumentType.types @@ -77,12 +77,12 @@ var r7 = map([1, ""], (x) => x.toString()); // error >[1, ""] : (string | number)[] >1 : 1 >"" : "" ->(x) => x.toString() : (x: number) => string ->x : number ->x.toString() : string ->x.toString : (radix?: number) => string ->x : number ->toString : (radix?: number) => string +>(x) => x.toString() : (x: any) => any +>x : any +>x.toString() : any +>x.toString : any +>x : any +>toString : any var r7b = map([1, ""], (x) => x.toString()); // error >r7b : unknown[] @@ -91,12 +91,12 @@ var r7b = map([1, ""], (x) => x.toString()); // error >[1, ""] : (string | number)[] >1 : 1 >"" : "" ->(x) => x.toString() : (x: number) => string ->x : number ->x.toString() : string ->x.toString : (radix?: number) => string ->x : number ->toString : (radix?: number) => string +>(x) => x.toString() : (x: any) => any +>x : any +>x.toString() : any +>x.toString : any +>x : any +>toString : any var r8 = map([1, ""], (x) => x.toString()); >r8 : string[] diff --git a/tests/baselines/reference/noImplicitAnyLoopCrash.errors.txt b/tests/baselines/reference/noImplicitAnyLoopCrash.errors.txt index 4450b128579d1..2937f133749d7 100644 --- a/tests/baselines/reference/noImplicitAnyLoopCrash.errors.txt +++ b/tests/baselines/reference/noImplicitAnyLoopCrash.errors.txt @@ -1,12 +1,18 @@ tests/cases/compiler/noImplicitAnyLoopCrash.ts(4,16): error TS2556: Expected 0 arguments, but got 1 or more. +tests/cases/compiler/noImplicitAnyLoopCrash.ts(4,19): error TS2461: Type 'number' is not an array type. +tests/cases/compiler/noImplicitAnyLoopCrash.ts(4,19): error TS2461: Type 'undefined' is not an array type. -==== tests/cases/compiler/noImplicitAnyLoopCrash.ts (1 errors) ==== +==== tests/cases/compiler/noImplicitAnyLoopCrash.ts (3 errors) ==== let foo = () => {}; let bar; while (1) { bar = ~foo(...bar); ~~~~~~ !!! error TS2556: Expected 0 arguments, but got 1 or more. + ~~~ +!!! error TS2461: Type 'number' is not an array type. + ~~~ +!!! error TS2461: Type 'undefined' is not an array type. } \ No newline at end of file diff --git a/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.types b/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.types index 2d807f4ec7d33..4cc5cf245cc44 100644 --- a/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.types +++ b/tests/baselines/reference/thisExpressionInCallExpressionWithTypeArguments.types @@ -11,8 +11,8 @@ class C { >2 : 2 >3 : 3 >map : (callbackfn: (value: number, index: number, array: number[]) => U, thisArg?: any) => U[] ->(x) => { return this; } : (x: number) => this ->x : number +>(x) => { return this; } : (x: any) => this +>x : any >this : this } diff --git a/tests/baselines/reference/typeInferenceConflictingCandidates.types b/tests/baselines/reference/typeInferenceConflictingCandidates.types index 27044d6e1d8b1..feb23253effdc 100644 --- a/tests/baselines/reference/typeInferenceConflictingCandidates.types +++ b/tests/baselines/reference/typeInferenceConflictingCandidates.types @@ -11,7 +11,7 @@ g("", 3, a => a); >g : (a: T, b: T, c: (t: T) => T) => T >"" : "" >3 : 3 ->a => a : (a: "") => "" ->a : "" ->a : "" +>a => a : (a: any) => any +>a : any +>a : any diff --git a/tests/baselines/reference/undeclaredModuleError.errors.txt b/tests/baselines/reference/undeclaredModuleError.errors.txt index 4d18d7e78cd0e..4a8248bfd6c96 100644 --- a/tests/baselines/reference/undeclaredModuleError.errors.txt +++ b/tests/baselines/reference/undeclaredModuleError.errors.txt @@ -1,9 +1,10 @@ tests/cases/compiler/undeclaredModuleError.ts(1,21): error TS2307: Cannot find module 'fs'. tests/cases/compiler/undeclaredModuleError.ts(8,29): error TS2345: Argument of type '() => void' is not assignable to parameter of type '(stat: any, name: string) => boolean'. Type 'void' is not assignable to type 'boolean'. +tests/cases/compiler/undeclaredModuleError.ts(11,41): error TS2304: Cannot find name 'IDoNotExist'. -==== tests/cases/compiler/undeclaredModuleError.ts (2 errors) ==== +==== tests/cases/compiler/undeclaredModuleError.ts (3 errors) ==== import fs = require('fs'); ~~~~ !!! error TS2307: Cannot find module 'fs'. @@ -20,6 +21,8 @@ tests/cases/compiler/undeclaredModuleError.ts(8,29): error TS2345: Argument of t } , (error: Error, files: {}[]) => { files.forEach((file) => { var fullPath = join(IDoNotExist); + ~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'IDoNotExist'. } ); } ); } );