From 751054464ffcb068f1e2432084ce800d73e88e37 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 27 Feb 2015 21:24:28 +0100 Subject: [PATCH 01/14] Fixed VSDevMode.ps1 parameter info --- scripts/VSDevMode.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/VSDevMode.ps1 b/scripts/VSDevMode.ps1 index df34c9e778..47694286ed 100644 --- a/scripts/VSDevMode.ps1 +++ b/scripts/VSDevMode.ps1 @@ -2,7 +2,7 @@ .SYNOPSIS Run this PowerShell script to enable dev mode and/or a custom script for the TypeScript language service, e.g. -PS C:\> .\scripts\VSDevMode.ps1 -enableDevMode -tsScript C:\src\TypeScript\built\local\typescriptServices.js +PS C:\> .\scripts\VSDevMode.ps1 -enableDevMode -tsScript C:\src\TypeScript\built\local\ Note: If you get security errors, try running powershell as an Administrator and with the "-executionPolicy remoteSigned" switch @@ -13,7 +13,7 @@ Set to "12" for Dev12 (VS2013) or "14" (the default) for Dev14 (VS2015) Pass this switch to enable attaching a debugger to the language service .PARAMETER tsScript -The path to a custom language service script to use, e.g. "C:\src\TypeScript\built\local\typescriptServices.js" +The path to a directory containing a custom language service script to use (typescriptServices.js), e.g. "C:\src\TypeScript\built\local\" #> Param( [int]$vsVersion = 14, From 4dfed9c84ced83e3cac6f0a5b0d906519a9ba522 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 4 Mar 2015 13:13:54 -0800 Subject: [PATCH 02/14] Adding test to ensure comment before block is conserved --- tests/baselines/reference/commentOnBlock1.js | 11 +++++++++++ tests/baselines/reference/commentOnBlock1.types | 7 +++++++ tests/cases/compiler/commentOnBlock1.ts | 4 ++++ 3 files changed, 22 insertions(+) create mode 100644 tests/baselines/reference/commentOnBlock1.js create mode 100644 tests/baselines/reference/commentOnBlock1.types create mode 100644 tests/cases/compiler/commentOnBlock1.ts diff --git a/tests/baselines/reference/commentOnBlock1.js b/tests/baselines/reference/commentOnBlock1.js new file mode 100644 index 0000000000..ed5437c1f6 --- /dev/null +++ b/tests/baselines/reference/commentOnBlock1.js @@ -0,0 +1,11 @@ +//// [commentOnBlock1.ts] +// asdf +function f() { + /*asdf*/{} +} + +//// [commentOnBlock1.js] +// asdf +function f() { + /*asdf*/ { } +} diff --git a/tests/baselines/reference/commentOnBlock1.types b/tests/baselines/reference/commentOnBlock1.types new file mode 100644 index 0000000000..cc01efddb1 --- /dev/null +++ b/tests/baselines/reference/commentOnBlock1.types @@ -0,0 +1,7 @@ +=== tests/cases/compiler/commentOnBlock1.ts === +// asdf +function f() { +>f : () => void + + /*asdf*/{} +} diff --git a/tests/cases/compiler/commentOnBlock1.ts b/tests/cases/compiler/commentOnBlock1.ts new file mode 100644 index 0000000000..1c9947d15b --- /dev/null +++ b/tests/cases/compiler/commentOnBlock1.ts @@ -0,0 +1,4 @@ +// asdf +function f() { + /*asdf*/{} +} \ No newline at end of file From d3fbebf3fb6079856d9e01621f78f0ed097e48a1 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 4 Mar 2015 18:15:55 -0800 Subject: [PATCH 03/14] Never use the entire span of a function declaration or function expression when reporting a checker error. --- src/compiler/checker.ts | 23 +-- src/compiler/program.ts | 14 +- src/compiler/utilities.ts | 62 +++++-- .../reference/ambientErrors.errors.txt | 4 +- .../reference/anyIdenticalToItself.errors.txt | 4 +- ...ambdaToNominalSubtypeOfFunction.errors.txt | 2 +- ...uperAndLocalFunctionInAccessors.errors.txt | 28 ++-- ...erAndLocalFunctionInConstructor.errors.txt | 14 +- ...onSuperAndLocalFunctionInMethod.errors.txt | 14 +- ...SuperAndLocalFunctionInProperty.errors.txt | 7 +- ...tOverloadFunctionNoSubtypeError.errors.txt | 12 +- ...ertyIsRelatableToTargetProperty.errors.txt | 4 +- .../exportAssignDottedName.errors.txt | 10 +- .../exportAssignImportedIdentifier.errors.txt | 10 +- ...nAndInterfaceWithSeparateErrors.errors.txt | 4 +- .../functionImplementationErrors.errors.txt | 84 ++++------ .../functionOverloadErrors.errors.txt | 12 +- .../reference/functionOverloads11.errors.txt | 4 +- .../reference/functionOverloads17.errors.txt | 4 +- .../reference/functionOverloads18.errors.txt | 4 +- .../reference/functionOverloads19.errors.txt | 4 +- .../reference/functionOverloads20.errors.txt | 4 +- .../reference/functionOverloads22.errors.txt | 4 +- .../reference/functionOverloads4.errors.txt | 4 +- ...ionWithMultipleReturnStatements.errors.txt | 156 ++++++------------ ...onWithMultipleReturnStatements2.errors.txt | 44 ++--- .../functionWithNoBestCommonType1.errors.txt | 13 ++ .../functionWithNoBestCommonType1.js | 16 ++ .../functionWithNoBestCommonType2.errors.txt | 13 ++ .../functionWithNoBestCommonType2.js | 16 ++ .../reference/implicitAnyAmbients.errors.txt | 8 +- .../implicitAnyCastedValue.errors.txt | 10 +- ...reFunctionExprWithoutFormalType.errors.txt | 8 +- ...mplicitAnyFromCircularInference.errors.txt | 8 +- ...nyFunctionReturnNullOrUndefined.errors.txt | 8 +- ...licitAnyInAmbientDeclaration2.d.errors.txt | 4 +- ...edFunctionReturnTypeIsEmptyType.errors.txt | 25 +-- .../noImplicitAnyFunctions.errors.txt | 18 +- .../reference/noImplicitAnyModule.errors.txt | 4 +- .../noImplicitAnyWithOverloads.errors.txt | 8 +- .../overloadAssignmentCompat.errors.txt | 4 +- ...verloadOnConstConstraintChecks4.errors.txt | 4 +- ...rloadOnConstDuplicateOverloads1.errors.txt | 8 +- ...loadOnConstantsInvalidOverload1.errors.txt | 14 +- .../overloadingOnConstants2.errors.txt | 12 +- ...dingOnConstantsInImplementation.errors.txt | 17 +- .../reference/parserArgumentList1.errors.txt | 12 +- ...rserModifierOnStatementInBlock1.errors.txt | 8 +- ...rserModifierOnStatementInBlock3.errors.txt | 9 +- .../parserParameterList15.errors.txt | 4 +- .../parserUnaryExpression2.errors.txt | 2 +- .../recursiveFunctionTypes.errors.txt | 4 +- ...lizedOverloadWithRestParameters.errors.txt | 8 +- ...ubtypeOfNonSpecializedSignature.errors.txt | 4 +- ...ingLiteralTypeIsSubtypeOfString.errors.txt | 28 ++-- ...TypesInImplementationSignatures.errors.txt | 12 +- ...ypesInImplementationSignatures2.errors.txt | 4 +- .../reference/targetTypeVoidFunc.errors.txt | 2 +- ...teStringInFunctionParameterType.errors.txt | 6 +- ...tringInFunctionParameterTypeES6.errors.txt | 6 +- .../voidAsNonAmbiguousReturnType.errors.txt | 4 +- .../compiler/functionWithNoBestCommonType1.ts | 7 + .../compiler/functionWithNoBestCommonType2.ts | 7 + 63 files changed, 423 insertions(+), 458 deletions(-) create mode 100644 tests/baselines/reference/functionWithNoBestCommonType1.errors.txt create mode 100644 tests/baselines/reference/functionWithNoBestCommonType1.js create mode 100644 tests/baselines/reference/functionWithNoBestCommonType2.errors.txt create mode 100644 tests/baselines/reference/functionWithNoBestCommonType2.js create mode 100644 tests/cases/compiler/functionWithNoBestCommonType1.ts create mode 100644 tests/cases/compiler/functionWithNoBestCommonType2.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 9daa87daed..7220182bfe 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -8605,7 +8605,7 @@ module ts { // since LHS will be block scoped name instead of function scoped if (!namesShareScope) { var name = symbolToString(localDeclarationSymbol); - error(getErrorSpanForNode(node), Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); + error(node, Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name); } } } @@ -11817,19 +11817,11 @@ module ts { return sourceFile.parseDiagnostics.length > 0; } - function scanToken(scanner: Scanner, pos: number) { - scanner.setTextPos(pos); - scanner.scan(); - var start = scanner.getTokenPos(); - return start; - } - function grammarErrorOnFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { var sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - var scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceFile.text); - var start = scanToken(scanner, node.pos); - diagnostics.add(createFileDiagnostic(sourceFile, start, scanner.getTextPos() - start, message, arg0, arg1, arg2)); + var span = getSpanOfTokenAtPosition(sourceFile, node.pos); + diagnostics.add(createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2)); return true; } } @@ -11844,9 +11836,7 @@ module ts { function grammarErrorOnNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { var sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - var span = getErrorSpanForNode(node); - var start = span.end > span.pos ? skipTrivia(sourceFile.text, span.pos) : span.pos; - diagnostics.add(createFileDiagnostic(sourceFile, start, span.end - start, message, arg0, arg1, arg2)); + diagnostics.add(createDiagnosticForNode(node, message, arg0, arg1, arg2)); return true; } } @@ -11983,9 +11973,8 @@ module ts { function grammarErrorAfterFirstToken(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): boolean { var sourceFile = getSourceFileOfNode(node); if (!hasParseDiagnostics(sourceFile)) { - var scanner = createScanner(languageVersion, /*skipTrivia*/ true, sourceFile.text); - scanToken(scanner, node.pos); - diagnostics.add(createFileDiagnostic(sourceFile, scanner.getTextPos(), 0, message, arg0, arg1, arg2)); + var span = getSpanOfTokenAtPosition(sourceFile, node.pos); + diagnostics.add(createFileDiagnostic(sourceFile, textSpanEnd(span), /*length*/ 0, message, arg0, arg1, arg2)); return true; } } diff --git a/src/compiler/program.ts b/src/compiler/program.ts index 88ab2825fd..9d1dc65244 100644 --- a/src/compiler/program.ts +++ b/src/compiler/program.ts @@ -423,13 +423,11 @@ module ts { return; } - var firstExternalModule = forEach(files, f => isExternalModule(f) ? f : undefined); - if (firstExternalModule && !options.module) { - // We cannot use createDiagnosticFromNode because nodes do not have parents yet - var externalModuleErrorSpan = getErrorSpanForNode(firstExternalModule.externalModuleIndicator); - var errorStart = skipTrivia(firstExternalModule.text, externalModuleErrorSpan.pos); - var errorLength = externalModuleErrorSpan.end - errorStart; - diagnostics.add(createFileDiagnostic(firstExternalModule, errorStart, errorLength, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); + var firstExternalModuleSourceFile = forEach(files, f => isExternalModule(f) ? f : undefined); + if (firstExternalModuleSourceFile && !options.module) { + // We cannot use createDiagnosticFromNode because nodes do not have parents yet + var span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator); + diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided)); } // there has to be common source directory if user specified --outdir || --sourcRoot @@ -437,7 +435,7 @@ module ts { if (options.outDir || // there is --outDir specified options.sourceRoot || // there is --sourceRoot specified (options.mapRoot && // there is --mapRoot Specified and there would be multiple js files generated - (!options.out || firstExternalModule !== undefined))) { + (!options.out || firstExternalModuleSourceFile !== undefined))) { var commonPathComponents: string[]; forEach(files, sourceFile => { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index cb8f7f537b..f2687a151a 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -218,32 +218,39 @@ module ts { } export function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: any, arg1?: any, arg2?: any): Diagnostic { - node = getErrorSpanForNode(node); - var file = getSourceFileOfNode(node); - - var start = getTokenPosOfNode(node, file); - var length = node.end - start; - - return createFileDiagnostic(file, start, length, message, arg0, arg1, arg2); + var sourceFile = getSourceFileOfNode(node); + var span = getErrorSpanForNode(sourceFile, node); + return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2); } export function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain): Diagnostic { - node = getErrorSpanForNode(node); - var file = getSourceFileOfNode(node); - var start = skipTrivia(file.text, node.pos); - var length = node.end - start; + var sourceFile = getSourceFileOfNode(node); + var span = getErrorSpanForNode(sourceFile, node); return { - file, - start, - length, + file: sourceFile, + start: span.start, + length: span.length, code: messageChain.code, category: messageChain.category, messageText: messageChain.next ? messageChain : messageChain.messageText }; } - export function getErrorSpanForNode(node: Node): Node { - var errorSpan: Node; + interface FileTextRange extends TextRange { + sourceFile: SourceFile; + } + + /* @internal */ + export function getSpanOfTokenAtPosition(sourceFile: SourceFile, pos: number): TextSpan { + var scanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/ true, sourceFile.text); + scanner.setTextPos(pos); + scanner.scan(); + var start = scanner.getTokenPos(); + return createTextSpanFromBounds(start, scanner.getTextPos()); + } + + export function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan { + var errorNode: Node; switch (node.kind) { // This list is a work in progress. Add missing node kinds to improve their error // spans. @@ -254,16 +261,35 @@ module ts { case SyntaxKind.ModuleDeclaration: case SyntaxKind.EnumDeclaration: case SyntaxKind.EnumMember: - errorSpan = (node).name; + case SyntaxKind.FunctionDeclaration: + case SyntaxKind.FunctionExpression: + errorNode = (node).name; break; } + + if (node.kind === SyntaxKind.FunctionExpression) { + var functionExpression = node; + if (nodeIsMissing(functionExpression.name)) { + // If it's an anonymous function expression, put the error on the first token. + return getSpanOfTokenAtPosition(sourceFile, node.pos); + } + else { + errorNode = functionExpression.name; + } + } // We now have the ideal error span, but it may be a node that is optional and absent // (e.g. the name of a function expression), in which case errorSpan will be undefined. // Alternatively, it might be required and missing (e.g. the name of a module), in which // case its pos will equal its end (length 0). In either of these cases, we should fall // back to the original node that the error was issued on. - return errorSpan && errorSpan.pos < errorSpan.end ? errorSpan : node; + errorNode = nodeIsMissing(errorNode) ? node : errorNode; + + var pos = nodeIsMissing(errorNode) + ? errorNode.pos + : skipTrivia(sourceFile.text, errorNode.pos); + + return createTextSpanFromBounds(pos, errorNode.end); } export function isExternalModule(file: SourceFile): boolean { diff --git a/tests/baselines/reference/ambientErrors.errors.txt b/tests/baselines/reference/ambientErrors.errors.txt index c8159708dd..a741536e07 100644 --- a/tests/baselines/reference/ambientErrors.errors.txt +++ b/tests/baselines/reference/ambientErrors.errors.txt @@ -1,5 +1,5 @@ tests/cases/conformance/ambient/ambientErrors.ts(2,15): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/conformance/ambient/ambientErrors.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/ambient/ambientErrors.ts(6,18): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/ambient/ambientErrors.ts(17,22): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. tests/cases/conformance/ambient/ambientErrors.ts(20,24): error TS1184: An implementation cannot be declared in ambient contexts. tests/cases/conformance/ambient/ambientErrors.ts(24,5): error TS1066: Ambient enum elements can only have integer literal initializers. @@ -25,7 +25,7 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export // Ambient functions with invalid overloads declare function fn(x: number): string; declare function fn(x: 'foo'): number; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. // Ambient functions with duplicate signatures diff --git a/tests/baselines/reference/anyIdenticalToItself.errors.txt b/tests/baselines/reference/anyIdenticalToItself.errors.txt index 6b82f3af73..bcd3b52dae 100644 --- a/tests/baselines/reference/anyIdenticalToItself.errors.txt +++ b/tests/baselines/reference/anyIdenticalToItself.errors.txt @@ -1,11 +1,11 @@ -tests/cases/compiler/anyIdenticalToItself.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/anyIdenticalToItself.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. tests/cases/compiler/anyIdenticalToItself.ts(6,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/anyIdenticalToItself.ts(10,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ==== tests/cases/compiler/anyIdenticalToItself.ts (3 errors) ==== function foo(x: any); - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function foo(x: any); function foo(x: any, y: number) { } diff --git a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.errors.txt b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.errors.txt index 580c6fa3c4..f462fd347e 100644 --- a/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.errors.txt +++ b/tests/baselines/reference/assignLambdaToNominalSubtypeOfFunction.errors.txt @@ -16,7 +16,7 @@ tests/cases/compiler/assignLambdaToNominalSubtypeOfFunction.ts(8,4): error TS234 !!! error TS2345: Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'. !!! error TS2345: Property 'x' is missing in type '(a: any, b: any) => boolean'. fn(function (a, b) { return true; }) - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2345: Argument of type '(a: any, b: any) => boolean' is not assignable to parameter of type 'IResultCallback'. !!! error TS2345: Property 'x' is missing in type '(a: any, b: any) => boolean'. \ No newline at end of file diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt index 6a459b222c..16b4edced7 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInAccessors.errors.txt @@ -1,13 +1,13 @@ tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(4,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(9,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(15,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(16,9): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(16,18): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(20,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(21,9): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(21,18): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(26,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(28,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(28,22): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(33,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(35,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(35,22): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. ==== tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts (10 errors) ==== @@ -33,20 +33,18 @@ tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(35,13): error ~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. function _super() { // Should be error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~~~~~ + ~~~~~~ !!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + } return 10; } set prop2(val: number) { ~~~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. function _super() { // Should be error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~~~~~ + ~~~~~~ !!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + } } } class c extends Foo { @@ -55,10 +53,9 @@ tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(35,13): error !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x = () => { function _super() { // Should be error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~~~~~~~~~ + ~~~~~~ !!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + } } return 10; } @@ -67,10 +64,9 @@ tests/cases/compiler/collisionSuperAndLocalFunctionInAccessors.ts(35,13): error !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. var x = () => { function _super() { // Should be error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~~~~~~~~~ + ~~~~~~ !!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + } } } } \ No newline at end of file diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.errors.txt b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.errors.txt index 8fce8f63f9..5e1ec686bf 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInConstructor.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/collisionSuperAndLocalFunctionInConstructor.ts(12,9): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. -tests/cases/compiler/collisionSuperAndLocalFunctionInConstructor.ts(20,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInConstructor.ts(12,18): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInConstructor.ts(20,22): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. ==== tests/cases/compiler/collisionSuperAndLocalFunctionInConstructor.ts (2 errors) ==== @@ -15,10 +15,9 @@ tests/cases/compiler/collisionSuperAndLocalFunctionInConstructor.ts(20,13): erro constructor() { super(); function _super() { // Should be error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~~~~~ + ~~~~~~ !!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + } } } class c extends Foo { @@ -26,10 +25,9 @@ tests/cases/compiler/collisionSuperAndLocalFunctionInConstructor.ts(20,13): erro super(); var x = () => { function _super() { // Should be error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~~~~~~~~~ + ~~~~~~ !!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + } } } } \ No newline at end of file diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.errors.txt b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.errors.txt index e45219e43c..e899858fcc 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInMethod.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/collisionSuperAndLocalFunctionInMethod.ts(13,9): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. -tests/cases/compiler/collisionSuperAndLocalFunctionInMethod.ts(22,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInMethod.ts(13,18): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInMethod.ts(22,22): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. ==== tests/cases/compiler/collisionSuperAndLocalFunctionInMethod.ts (2 errors) ==== @@ -16,10 +16,9 @@ tests/cases/compiler/collisionSuperAndLocalFunctionInMethod.ts(22,13): error TS2 class b extends Foo { public foo() { function _super() { // should be error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~~~~~ + ~~~~~~ !!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + } } _super() { // No Error } @@ -28,10 +27,9 @@ tests/cases/compiler/collisionSuperAndLocalFunctionInMethod.ts(22,13): error TS2 public foo() { var x = () => { function _super() { // should be error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~~~~~~~~~ + ~~~~~~ !!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + } } } _super() { // No error diff --git a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.errors.txt b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.errors.txt index 6313eb2d83..f5c585525e 100644 --- a/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.errors.txt +++ b/tests/baselines/reference/collisionSuperAndLocalFunctionInProperty.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/collisionSuperAndLocalFunctionInProperty.ts(14,13): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. +tests/cases/compiler/collisionSuperAndLocalFunctionInProperty.ts(14,22): error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. ==== tests/cases/compiler/collisionSuperAndLocalFunctionInProperty.ts (1 errors) ==== @@ -16,10 +16,9 @@ tests/cases/compiler/collisionSuperAndLocalFunctionInProperty.ts(14,13): error T public prop2 = { doStuff: () => { function _super() { // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~~~~~~~~~ + ~~~~~~ !!! error TS2401: Duplicate identifier '_super'. Compiler uses '_super' to capture base class reference. + } } } } \ No newline at end of file diff --git a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.errors.txt b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.errors.txt index b0a4a871f2..3c5e6f8efc 100644 --- a/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.errors.txt +++ b/tests/baselines/reference/constantOverloadFunctionNoSubtypeError.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(7,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(8,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(6,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(7,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. ==== tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts (3 errors) ==== @@ -10,13 +10,13 @@ tests/cases/compiler/constantOverloadFunctionNoSubtypeError.ts(8,1): error TS238 class Derived3 extends Base { biz() { } } function foo(tagName: 'canvas'): Derived3; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(tagName: 'div'): Derived2; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(tagName: 'span'): Derived1; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(tagName: number): Base; function foo(tagName: any): Base { diff --git a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt index 717d76309a..450d180e88 100644 --- a/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt +++ b/tests/baselines/reference/crashInsourcePropertyIsRelatableToTargetProperty.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts(5,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts(5,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts(9,5): error TS2322: Type '(x: "hi", items: string[]) => typeof foo' is not assignable to type 'D'. Property 'x' is missing in type '(x: "hi", items: string[]) => typeof foo'. @@ -9,7 +9,7 @@ tests/cases/compiler/crashInsourcePropertyIsRelatableToTargetProperty.ts(9,5): e } class D extends C { } function foo(x: "hi", items: string[]): typeof foo; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(x: string, items: string[]): typeof foo { return null; diff --git a/tests/baselines/reference/exportAssignDottedName.errors.txt b/tests/baselines/reference/exportAssignDottedName.errors.txt index 264e32c9ca..c2f732e0b4 100644 --- a/tests/baselines/reference/exportAssignDottedName.errors.txt +++ b/tests/baselines/reference/exportAssignDottedName.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot compile external modules unless the '--module' flag is provided. tests/cases/conformance/externalModules/foo2.ts(2,14): error TS1005: ';' expected. tests/cases/conformance/externalModules/foo2.ts(2,15): error TS2304: Cannot find name 'x'. @@ -13,10 +13,8 @@ tests/cases/conformance/externalModules/foo2.ts(2,15): error TS2304: Cannot find ==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== export function x(){ - ~~~~~~~~~~~~~~~~~~~~ - return true; - ~~~~~~~~~~~~~ - } - ~ + ~ !!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. + return true; + } \ No newline at end of file diff --git a/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt b/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt index 8aa25aee2a..a3e4702f1e 100644 --- a/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt +++ b/tests/baselines/reference/exportAssignImportedIdentifier.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/conformance/externalModules/foo1.ts(1,17): error TS1148: Cannot compile external modules unless the '--module' flag is provided. ==== tests/cases/conformance/externalModules/foo3.ts (0 errors) ==== @@ -6,12 +6,10 @@ tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compi var x = foo2(); // should be boolean ==== tests/cases/conformance/externalModules/foo1.ts (1 errors) ==== export function x(){ - ~~~~~~~~~~~~~~~~~~~~ - return true; - ~~~~~~~~~~~~~ - } - ~ + ~ !!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. + return true; + } ==== tests/cases/conformance/externalModules/foo2.ts (0 errors) ==== import foo1 = require('./foo1'); diff --git a/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt b/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt index 72f24af0c6..51287c8739 100644 --- a/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt +++ b/tests/baselines/reference/functionAndInterfaceWithSeparateErrors.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts(6,5): error TS2411: Property 'prop' of type 'number' is not assignable to string index type 'string'. ==== tests/cases/compiler/functionAndInterfaceWithSeparateErrors.ts (2 errors) ==== function Foo(s: string); - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function Foo(n: number) { } diff --git a/tests/baselines/reference/functionImplementationErrors.errors.txt b/tests/baselines/reference/functionImplementationErrors.errors.txt index 8ebd5aa272..0c74588c31 100644 --- a/tests/baselines/reference/functionImplementationErrors.errors.txt +++ b/tests/baselines/reference/functionImplementationErrors.errors.txt @@ -1,15 +1,15 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(2,10): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/functions/functionImplementationErrors.ts(6,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(6,19): error TS2354: No best common type exists among return expressions. tests/cases/conformance/functions/functionImplementationErrors.ts(10,10): error TS2354: No best common type exists among return expressions. tests/cases/conformance/functions/functionImplementationErrors.ts(16,10): error TS2354: No best common type exists among return expressions. tests/cases/conformance/functions/functionImplementationErrors.ts(25,16): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. tests/cases/conformance/functions/functionImplementationErrors.ts(30,17): error TS2373: Initializer of parameter 'n' cannot reference identifier 'm' declared after it. tests/cases/conformance/functions/functionImplementationErrors.ts(35,17): error TS2373: Initializer of parameter 'n' cannot reference identifier 'm' declared after it. tests/cases/conformance/functions/functionImplementationErrors.ts(40,28): error TS2355: A function whose declared type is neither 'void' nor 'any' must return a value or consist of a single 'throw' statement. -tests/cases/conformance/functions/functionImplementationErrors.ts(49,1): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(49,10): error TS2354: No best common type exists among return expressions. tests/cases/conformance/functions/functionImplementationErrors.ts(53,10): error TS2354: No best common type exists among return expressions. tests/cases/conformance/functions/functionImplementationErrors.ts(57,11): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/functions/functionImplementationErrors.ts(61,1): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/functions/functionImplementationErrors.ts(61,10): error TS2354: No best common type exists among return expressions. tests/cases/conformance/functions/functionImplementationErrors.ts(65,11): error TS2354: No best common type exists among return expressions. tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error TS2354: No best common type exists among return expressions. @@ -17,23 +17,17 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error ==== tests/cases/conformance/functions/functionImplementationErrors.ts (14 errors) ==== // FunctionExpression with no return type annotation with multiple return statements with unrelated types var f1 = function () { - ~~~~~~~~~~~~~ - return ''; - ~~~~~~~~~~~~~~ - return 3; - ~~~~~~~~~~~~~ - }; - ~ + ~~~~~~~~ !!! error TS2354: No best common type exists among return expressions. + return ''; + return 3; + }; var f2 = function x() { - ~~~~~~~~~~~~~~ - return ''; - ~~~~~~~~~~~~~~ - return 3; - ~~~~~~~~~~~~~ - }; - ~ + ~ !!! error TS2354: No best common type exists among return expressions. + return ''; + return 3; + }; var f3 = () => { ~~~~~~~ return ''; @@ -46,20 +40,14 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error // FunctionExpression with no return type annotation with return branch of number[] and other of string[] var f4 = function () { - ~~~~~~~~~~~~~ - if (true) { - ~~~~~~~~~~~~~~~ - return ['']; - ~~~~~~~~~~~~~~~~~~~~ - } else { - ~~~~~~~~~~~~ - return [1]; - ~~~~~~~~~~~~~~~~~~~ - } - ~~~~~ - } - ~ + ~~~~~~~~ !!! error TS2354: No best common type exists among return expressions. + if (true) { + return ['']; + } else { + return [1]; + } + } // Function implemetnation with non -void return type annotation with no return function f5(): number { @@ -95,23 +83,17 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error class Derived1 extends Base { private m; } class Derived2 extends Base { private n; } function f8() { - ~~~~~~~~~~~~~~~ + ~~ +!!! error TS2354: No best common type exists among return expressions. return new Derived1(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ return new Derived2(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~ -!!! error TS2354: No best common type exists among return expressions. var f9 = function () { - ~~~~~~~~~~~~~ - return new Derived1(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ - return new Derived2(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~ - }; - ~ + ~~~~~~~~ !!! error TS2354: No best common type exists among return expressions. + return new Derived1(); + return new Derived2(); + }; var f10 = () => { ~~~~~~~ return new Derived1(); @@ -122,23 +104,17 @@ tests/cases/conformance/functions/functionImplementationErrors.ts(69,11): error ~ !!! error TS2354: No best common type exists among return expressions. function f11() { - ~~~~~~~~~~~~~~~~ + ~~~ +!!! error TS2354: No best common type exists among return expressions. return new Base(); - ~~~~~~~~~~~~~~~~~~~~~~ return new AnotherClass(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ } - ~ -!!! error TS2354: No best common type exists among return expressions. var f12 = function () { - ~~~~~~~~~~~~~ - return new Base(); - ~~~~~~~~~~~~~~~~~~~~~~ - return new AnotherClass(); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - }; - ~ + ~~~~~~~~ !!! error TS2354: No best common type exists among return expressions. + return new Base(); + return new AnotherClass(); + }; var f13 = () => { ~~~~~~~ return new Base(); diff --git a/tests/baselines/reference/functionOverloadErrors.errors.txt b/tests/baselines/reference/functionOverloadErrors.errors.txt index bc4fea0a98..ae1dfeae4d 100644 --- a/tests/baselines/reference/functionOverloadErrors.errors.txt +++ b/tests/baselines/reference/functionOverloadErrors.errors.txt @@ -8,9 +8,9 @@ tests/cases/conformance/functions/functionOverloadErrors.ts(75,21): error TS2383 tests/cases/conformance/functions/functionOverloadErrors.ts(79,14): error TS2383: Overload signatures must all be exported or not exported. tests/cases/conformance/functions/functionOverloadErrors.ts(85,18): error TS2384: Overload signatures must all be ambient or non-ambient. tests/cases/conformance/functions/functionOverloadErrors.ts(90,18): error TS2384: Overload signatures must all be ambient or non-ambient. -tests/cases/conformance/functions/functionOverloadErrors.ts(94,1): error TS2394: Overload signature is not compatible with function implementation. -tests/cases/conformance/functions/functionOverloadErrors.ts(99,1): error TS2394: Overload signature is not compatible with function implementation. -tests/cases/conformance/functions/functionOverloadErrors.ts(103,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/functions/functionOverloadErrors.ts(94,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/functions/functionOverloadErrors.ts(99,10): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/functions/functionOverloadErrors.ts(103,10): error TS2394: Overload signature is not compatible with function implementation. tests/cases/conformance/functions/functionOverloadErrors.ts(116,19): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. @@ -129,20 +129,20 @@ tests/cases/conformance/functions/functionOverloadErrors.ts(116,19): error TS237 //Function overloads with fewer params than implementation signature function fewerParams(); - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function fewerParams(n: string) { } //Function implementation whose parameter types are not assignable to all corresponding overload signature parameters function fn13(n: string); - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function fn13(n: number) { } //Function overloads where return types are not all subtype of implementation return type function fn14(n: string): string; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function fn14() { return 3; diff --git a/tests/baselines/reference/functionOverloads11.errors.txt b/tests/baselines/reference/functionOverloads11.errors.txt index 18155cbe69..005ee9bb14 100644 --- a/tests/baselines/reference/functionOverloads11.errors.txt +++ b/tests/baselines/reference/functionOverloads11.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/functionOverloads11.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads11.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/compiler/functionOverloads11.ts (1 errors) ==== function foo():number; - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function foo():string { return "" } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads17.errors.txt b/tests/baselines/reference/functionOverloads17.errors.txt index 4456570263..febd2c03ac 100644 --- a/tests/baselines/reference/functionOverloads17.errors.txt +++ b/tests/baselines/reference/functionOverloads17.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/functionOverloads17.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads17.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/compiler/functionOverloads17.ts (1 errors) ==== function foo():{a:number;} - ~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function foo():{a:string;} { return {a:""} } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads18.errors.txt b/tests/baselines/reference/functionOverloads18.errors.txt index 384c1e3fa8..bec6a45ed8 100644 --- a/tests/baselines/reference/functionOverloads18.errors.txt +++ b/tests/baselines/reference/functionOverloads18.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/functionOverloads18.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads18.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/compiler/functionOverloads18.ts (1 errors) ==== function foo(bar:{a:number;}); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function foo(bar:{a:string;}) { return {a:""} } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads19.errors.txt b/tests/baselines/reference/functionOverloads19.errors.txt index 4c6935493e..d87ba17562 100644 --- a/tests/baselines/reference/functionOverloads19.errors.txt +++ b/tests/baselines/reference/functionOverloads19.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/functionOverloads19.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads19.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/compiler/functionOverloads19.ts (1 errors) ==== function foo(bar:{b:string;}); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function foo(bar:{a:string;}); function foo(bar:{a:any;}) { return {a:""} } diff --git a/tests/baselines/reference/functionOverloads20.errors.txt b/tests/baselines/reference/functionOverloads20.errors.txt index 2a51afefe0..6b33795bc3 100644 --- a/tests/baselines/reference/functionOverloads20.errors.txt +++ b/tests/baselines/reference/functionOverloads20.errors.txt @@ -1,9 +1,9 @@ -tests/cases/compiler/functionOverloads20.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads20.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/compiler/functionOverloads20.ts (1 errors) ==== function foo(bar:{a:number;}): number; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function foo(bar:{a:string;}): string; function foo(bar:{a:any;}): string {return ""} diff --git a/tests/baselines/reference/functionOverloads22.errors.txt b/tests/baselines/reference/functionOverloads22.errors.txt index bc075e0c3e..c9fc8aa2b2 100644 --- a/tests/baselines/reference/functionOverloads22.errors.txt +++ b/tests/baselines/reference/functionOverloads22.errors.txt @@ -1,10 +1,10 @@ -tests/cases/compiler/functionOverloads22.ts(2,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads22.ts(2,10): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/compiler/functionOverloads22.ts (1 errors) ==== function foo(bar:number):{a:number;}[]; function foo(bar:string):{a:number; b:string;}[]; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function foo(bar:any):{a:any;b?:any;}[] { return [{a:""}] } \ No newline at end of file diff --git a/tests/baselines/reference/functionOverloads4.errors.txt b/tests/baselines/reference/functionOverloads4.errors.txt index 1e41fde602..78d772a0f6 100644 --- a/tests/baselines/reference/functionOverloads4.errors.txt +++ b/tests/baselines/reference/functionOverloads4.errors.txt @@ -1,8 +1,8 @@ -tests/cases/compiler/functionOverloads4.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/functionOverloads4.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/compiler/functionOverloads4.ts (1 errors) ==== function foo():number; - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function foo():string { return "a" } \ No newline at end of file diff --git a/tests/baselines/reference/functionWithMultipleReturnStatements.errors.txt b/tests/baselines/reference/functionWithMultipleReturnStatements.errors.txt index d9a25e2456..8a57d8e08e 100644 --- a/tests/baselines/reference/functionWithMultipleReturnStatements.errors.txt +++ b/tests/baselines/reference/functionWithMultipleReturnStatements.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(4,1): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(12,1): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(22,1): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(31,1): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(43,1): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(48,1): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(56,1): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(4,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(12,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(22,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(31,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(43,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(48,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(56,10): error TS2354: No best common type exists among return expressions. tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(56,13): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements.ts(56,26): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. @@ -14,126 +14,80 @@ tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMulti // it is an error if there is no single BCT, these are error cases function f1() { - ~~~~~~~~~~~~~~~ - if (true) { - ~~~~~~~~~~~~~~~ - return 1; - ~~~~~~~~~~~~~~~~~ - } else { - ~~~~~~~~~~~~ - return ''; - ~~~~~~~~~~~~~~~~~~ - } - ~~~~~ - } - ~ + ~~ !!! error TS2354: No best common type exists among return expressions. + if (true) { + return 1; + } else { + return ''; + } + } function f2() { - ~~~~~~~~~~~~~~~ - if (true) { - ~~~~~~~~~~~~~~~ - return 1; - ~~~~~~~~~~~~~~~~~ - } else if (false) { - ~~~~~~~~~~~~~~~~~~~~~~~ - return 2; - ~~~~~~~~~~~~~~~~~ - } else { - ~~~~~~~~~~~~ - return ''; - ~~~~~~~~~~~~~~~~~~ - } - ~~~~~ - } - ~ + ~~ !!! error TS2354: No best common type exists among return expressions. + if (true) { + return 1; + } else if (false) { + return 2; + } else { + return ''; + } + } function f3() { - ~~~~~~~~~~~~~~~ - try { - ~~~~~~~~~ - return 1; - ~~~~~~~~~~~~~~~~~ - } - ~~~~~ - catch (e) { - ~~~~~~~~~~~~~~~ - return ''; - ~~~~~~~~~~~~~~~~~~ - } - ~~~~~ - } - ~ + ~~ !!! error TS2354: No best common type exists among return expressions. + try { + return 1; + } + catch (e) { + return ''; + } + } function f4() { - ~~~~~~~~~~~~~~~ - try { - ~~~~~~~~~ - return 1; - ~~~~~~~~~~~~~~~~~ - } - ~~~~~ - catch (e) { - ~~~~~~~~~~~~~~~ - - - } - ~~~~~ - finally { - ~~~~~~~~~~~~~ - return ''; - ~~~~~~~~~~~~~~~~~~ - } - ~~~~~ - } - ~ + ~~ !!! error TS2354: No best common type exists among return expressions. + try { + return 1; + } + catch (e) { + + } + finally { + return ''; + } + } function f5() { - ~~~~~~~~~~~~~~~ - return 1; - ~~~~~~~~~~~~~ - return ''; - ~~~~~~~~~~~~~~ - } - ~ + ~~ !!! error TS2354: No best common type exists among return expressions. + return 1; + return ''; + } function f6(x: T, y:U) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - if (true) { - ~~~~~~~~~~~~~~~ - return x; - ~~~~~~~~~~~~~~~~~ - } else { - ~~~~~~~~~~~~ - return y; - ~~~~~~~~~~~~~~~~~ - } - ~~~~~ - } - ~ + ~~ !!! error TS2354: No best common type exists among return expressions. + if (true) { + return x; + } else { + return y; + } + } function f8(x: T, y: U) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~ +!!! error TS2354: No best common type exists among return expressions. ~~~~~~~~~~~ !!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. ~~~~~~~~~~~ !!! error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. if (true) { - ~~~~~~~~~~~~~~~ return x; - ~~~~~~~~~~~~~~~~~ } else { - ~~~~~~~~~~~~ return y; - ~~~~~~~~~~~~~~~~~ } - ~~~~~ } - ~ -!!! error TS2354: No best common type exists among return expressions. \ No newline at end of file diff --git a/tests/baselines/reference/functionWithMultipleReturnStatements2.errors.txt b/tests/baselines/reference/functionWithMultipleReturnStatements2.errors.txt index 2b14bd97ba..bbaa5a8557 100644 --- a/tests/baselines/reference/functionWithMultipleReturnStatements2.errors.txt +++ b/tests/baselines/reference/functionWithMultipleReturnStatements2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts(58,1): error TS2354: No best common type exists among return expressions. -tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts(67,1): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts(58,10): error TS2354: No best common type exists among return expressions. +tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts(67,10): error TS2354: No best common type exists among return expressions. ==== tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMultipleReturnStatements2.ts (2 errors) ==== @@ -61,37 +61,25 @@ tests/cases/conformance/types/typeRelationships/bestCommonType/functionWithMulti var b: { x: number; z?: number }; // returns typeof a function f9() { - ~~~~~~~~~~~~~~~ - if (true) { - ~~~~~~~~~~~~~~~ - return a; - ~~~~~~~~~~~~~~~~~ - } else { - ~~~~~~~~~~~~ - return b; - ~~~~~~~~~~~~~~~~~ - } - ~~~~~ - } - ~ + ~~ !!! error TS2354: No best common type exists among return expressions. + if (true) { + return a; + } else { + return b; + } + } // returns typeof b function f10() { - ~~~~~~~~~~~~~~~~ - if (true) { - ~~~~~~~~~~~~~~~ - return b; - ~~~~~~~~~~~~~~~~~ - } else { - ~~~~~~~~~~~~ - return a; - ~~~~~~~~~~~~~~~~~ - } - ~~~~~ - } - ~ + ~~~ !!! error TS2354: No best common type exists among return expressions. + if (true) { + return b; + } else { + return a; + } + } // returns number => void function f11() { diff --git a/tests/baselines/reference/functionWithNoBestCommonType1.errors.txt b/tests/baselines/reference/functionWithNoBestCommonType1.errors.txt new file mode 100644 index 0000000000..3c8fef3eb4 --- /dev/null +++ b/tests/baselines/reference/functionWithNoBestCommonType1.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/functionWithNoBestCommonType1.ts(1,10): error TS2354: No best common type exists among return expressions. + + +==== tests/cases/compiler/functionWithNoBestCommonType1.ts (1 errors) ==== + function foo() { + ~~~ +!!! error TS2354: No best common type exists among return expressions. + return true; + return bar(); + } + + function bar(): void { + } \ No newline at end of file diff --git a/tests/baselines/reference/functionWithNoBestCommonType1.js b/tests/baselines/reference/functionWithNoBestCommonType1.js new file mode 100644 index 0000000000..f7114fb40d --- /dev/null +++ b/tests/baselines/reference/functionWithNoBestCommonType1.js @@ -0,0 +1,16 @@ +//// [functionWithNoBestCommonType1.ts] +function foo() { + return true; + return bar(); +} + +function bar(): void { +} + +//// [functionWithNoBestCommonType1.js] +function foo() { + return true; + return bar(); +} +function bar() { +} diff --git a/tests/baselines/reference/functionWithNoBestCommonType2.errors.txt b/tests/baselines/reference/functionWithNoBestCommonType2.errors.txt new file mode 100644 index 0000000000..981e330d9b --- /dev/null +++ b/tests/baselines/reference/functionWithNoBestCommonType2.errors.txt @@ -0,0 +1,13 @@ +tests/cases/compiler/functionWithNoBestCommonType2.ts(1,9): error TS2354: No best common type exists among return expressions. + + +==== tests/cases/compiler/functionWithNoBestCommonType2.ts (1 errors) ==== + var v = function () { + ~~~~~~~~ +!!! error TS2354: No best common type exists among return expressions. + return true; + return bar(); + }; + + function bar(): void { + } \ No newline at end of file diff --git a/tests/baselines/reference/functionWithNoBestCommonType2.js b/tests/baselines/reference/functionWithNoBestCommonType2.js new file mode 100644 index 0000000000..8e903518ec --- /dev/null +++ b/tests/baselines/reference/functionWithNoBestCommonType2.js @@ -0,0 +1,16 @@ +//// [functionWithNoBestCommonType2.ts] +var v = function () { + return true; + return bar(); +}; + +function bar(): void { +} + +//// [functionWithNoBestCommonType2.js] +var v = function () { + return true; + return bar(); +}; +function bar() { +} diff --git a/tests/baselines/reference/implicitAnyAmbients.errors.txt b/tests/baselines/reference/implicitAnyAmbients.errors.txt index 699bd4b7f3..e71fd6f72e 100644 --- a/tests/baselines/reference/implicitAnyAmbients.errors.txt +++ b/tests/baselines/reference/implicitAnyAmbients.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/implicitAnyAmbients.ts(3,9): error TS7005: Variable 'x' implicitly has an 'any' type. -tests/cases/compiler/implicitAnyAmbients.ts(6,5): error TS7010: 'f', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyAmbients.ts(6,14): error TS7010: 'f', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyAmbients.ts(6,16): error TS7006: Parameter 'x' implicitly has an 'any' type. -tests/cases/compiler/implicitAnyAmbients.ts(7,5): error TS7010: 'f2', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyAmbients.ts(7,14): error TS7010: 'f2', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyAmbients.ts(11,9): error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyAmbients.ts(12,9): error TS7010: 'foo2', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyAmbients.ts(17,9): error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. @@ -18,12 +18,12 @@ tests/cases/compiler/implicitAnyAmbients.ts(23,13): error TS7005: Variable 'y' i var y: any; function f(x); // error - ~~~~~~~~~~~~~~ + ~ !!! error TS7010: 'f', which lacks return-type annotation, implicitly has an 'any' return type. ~ !!! error TS7006: Parameter 'x' implicitly has an 'any' type. function f2(x: any); // error - ~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS7010: 'f2', which lacks return-type annotation, implicitly has an 'any' return type. function f3(x: any): any; diff --git a/tests/baselines/reference/implicitAnyCastedValue.errors.txt b/tests/baselines/reference/implicitAnyCastedValue.errors.txt index 613aa4820d..773fb2ed94 100644 --- a/tests/baselines/reference/implicitAnyCastedValue.errors.txt +++ b/tests/baselines/reference/implicitAnyCastedValue.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/implicitAnyCastedValue.ts(12,16): error TS1056: Accessors a tests/cases/compiler/implicitAnyCastedValue.ts(26,5): error TS7008: Member 'getValue' implicitly has an 'any' type. tests/cases/compiler/implicitAnyCastedValue.ts(28,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/implicitAnyCastedValue.ts(32,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/compiler/implicitAnyCastedValue.ts(41,1): error TS7010: 'notCastedNull', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyCastedValue.ts(41,10): error TS7010: 'notCastedNull', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyCastedValue.ts(53,24): error TS7006: Parameter 'x' implicitly has an 'any' type. tests/cases/compiler/implicitAnyCastedValue.ts(62,24): error TS7006: Parameter 'x' implicitly has an 'any' type. @@ -63,12 +63,10 @@ tests/cases/compiler/implicitAnyCastedValue.ts(62,24): error TS7006: Parameter ' } function notCastedNull() { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ - return null; // this should be an error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~ + ~~~~~~~~~~~~~ !!! error TS7010: 'notCastedNull', which lacks return-type annotation, implicitly has an 'any' return type. + return null; // this should be an error + } function returnTypeBar(): any { return null; // this should not be an error diff --git a/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.errors.txt b/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.errors.txt index 34aa58c419..bc2a9437e4 100644 --- a/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.errors.txt +++ b/tests/baselines/reference/implicitAnyDeclareFunctionExprWithoutFormalType.errors.txt @@ -2,9 +2,9 @@ tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(2,15): e tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(3,15): error TS7006: Parameter 'll1' implicitly has an 'any' type. tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(4,33): error TS7006: Parameter 'myParam' implicitly has an 'any' type. tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(5,14): error TS7011: Function expression, which lacks return-type annotation, implicitly has an 'any' return type. -tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(8,15): error TS7010: 'temp', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(8,24): error TS7010: 'temp', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(9,15): error TS7011: Function expression, which lacks return-type annotation, implicitly has an 'any' return type. -tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(10,15): error TS7010: 'temp', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(10,24): error TS7010: 'temp', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(11,15): error TS7011: Function expression, which lacks return-type annotation, implicitly has an 'any' return type. @@ -25,13 +25,13 @@ tests/cases/compiler/implicitAnyDeclareFunctionExprWithoutFormalType.ts(11,15): // these should be error for implicit any return type var lambda5 = function temp() { return null; } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS7010: 'temp', which lacks return-type annotation, implicitly has an 'any' return type. var lambda6 = () => { return null; } ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS7011: Function expression, which lacks return-type annotation, implicitly has an 'any' return type. var lambda7 = function temp() { return undefined; } - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~ !!! error TS7010: 'temp', which lacks return-type annotation, implicitly has an 'any' return type. var lambda8 = () => { return undefined; } ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/implicitAnyFromCircularInference.errors.txt b/tests/baselines/reference/implicitAnyFromCircularInference.errors.txt index 7b80d6405c..18292c635e 100644 --- a/tests/baselines/reference/implicitAnyFromCircularInference.errors.txt +++ b/tests/baselines/reference/implicitAnyFromCircularInference.errors.txt @@ -36,12 +36,10 @@ tests/cases/compiler/implicitAnyFromCircularInference.ts(46,5): error TS7023: 'x // Error expected var f1 = function () { - ~~~~~~~~~~~~~ - return f1(); - ~~~~~~~~~~~~~~~~ - }; - ~ + ~~~~~~~~ !!! error TS7024: Function implicitly has return type 'any' because it does not have a return type annotation and is referenced directly or indirectly in one of its return expressions. + return f1(); + }; // Error expected var f2 = () => f2(); diff --git a/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.errors.txt b/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.errors.txt index de1c57dd79..9ad1c550d7 100644 --- a/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.errors.txt +++ b/tests/baselines/reference/implicitAnyFunctionReturnNullOrUndefined.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(2,1): error TS7010: 'nullWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. -tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(3,1): error TS7010: 'undefinedWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(2,10): error TS7010: 'nullWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(3,10): error TS7010: 'undefinedWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(6,5): error TS7010: 'nullWidenFuncOfC', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(10,5): error TS7010: 'underfinedWidenFuncOfC', which lacks return-type annotation, implicitly has an 'any' return type. @@ -7,10 +7,10 @@ tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts(10,5): error TS ==== tests/cases/compiler/implicitAnyFunctionReturnNullOrUndefined.ts (4 errors) ==== // this should be an error function nullWidenFunction() { return null;} // error at "nullWidenFunction" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~ !!! error TS7010: 'nullWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. function undefinedWidenFunction() { return undefined; } // error at "undefinedWidenFunction" - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~~~~~~~~~~~~ !!! error TS7010: 'undefinedWidenFunction', which lacks return-type annotation, implicitly has an 'any' return type. class C { diff --git a/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt b/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt index 260dc6c989..11f2ae90d3 100644 --- a/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt +++ b/tests/baselines/reference/implicitAnyInAmbientDeclaration2.d.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(1,1): error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(1,18): error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(1,22): error TS7006: Parameter 'x' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(2,13): error TS7005: Variable 'bar' implicitly has an 'any' type. tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(4,5): error TS7008: Member 'publicMember' implicitly has an 'any' type. @@ -10,7 +10,7 @@ tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts(13,24): error TS7006: ==== tests/cases/compiler/implicitAnyInAmbientDeclaration2.d.ts (8 errors) ==== declare function foo(x); // this should be an error - ~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS7010: 'foo', which lacks return-type annotation, implicitly has an 'any' return type. ~ !!! error TS7006: Parameter 'x' implicitly has an 'any' type. diff --git a/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.errors.txt b/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.errors.txt index 915e75dd6d..99819ecad2 100644 --- a/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.errors.txt +++ b/tests/baselines/reference/inferredFunctionReturnTypeIsEmptyType.errors.txt @@ -1,22 +1,15 @@ -tests/cases/compiler/inferredFunctionReturnTypeIsEmptyType.ts(1,1): error TS2354: No best common type exists among return expressions. +tests/cases/compiler/inferredFunctionReturnTypeIsEmptyType.ts(1,10): error TS2354: No best common type exists among return expressions. ==== tests/cases/compiler/inferredFunctionReturnTypeIsEmptyType.ts (1 errors) ==== function foo() { - ~~~~~~~~~~~~~~~~ - if (true) { - ~~~~~~~~~~~~~~~ - return 42; - ~~~~~~~~~~~~~~~~~~ - } - ~~~~~ - else { - ~~~~~~~~~~ - return "42"; - ~~~~~~~~~~~~~~~~~~~~ - } - ~~~~~ - }; - ~ + ~~~ !!! error TS2354: No best common type exists among return expressions. + if (true) { + return 42; + } + else { + return "42"; + } + }; \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyFunctions.errors.txt b/tests/baselines/reference/noImplicitAnyFunctions.errors.txt index 622dd95315..158690deef 100644 --- a/tests/baselines/reference/noImplicitAnyFunctions.errors.txt +++ b/tests/baselines/reference/noImplicitAnyFunctions.errors.txt @@ -1,14 +1,14 @@ -tests/cases/compiler/noImplicitAnyFunctions.ts(2,1): error TS7010: 'f1', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyFunctions.ts(2,18): error TS7010: 'f1', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/noImplicitAnyFunctions.ts(6,13): error TS7006: Parameter 'x' implicitly has an 'any' type. -tests/cases/compiler/noImplicitAnyFunctions.ts(17,1): error TS7010: 'f6', which lacks return-type annotation, implicitly has an 'any' return type. -tests/cases/compiler/noImplicitAnyFunctions.ts(19,1): error TS7010: 'f6', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyFunctions.ts(17,10): error TS7010: 'f6', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyFunctions.ts(19,10): error TS7010: 'f6', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/noImplicitAnyFunctions.ts(19,24): error TS7006: Parameter 'y' implicitly has an 'any' type. ==== tests/cases/compiler/noImplicitAnyFunctions.ts (5 errors) ==== declare function f1(); - ~~~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS7010: 'f1', which lacks return-type annotation, implicitly has an 'any' return type. declare function f2(): any; @@ -27,15 +27,13 @@ tests/cases/compiler/noImplicitAnyFunctions.ts(19,24): error TS7006: Parameter ' } function f6(x: string, y: number); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS7010: 'f6', which lacks return-type annotation, implicitly has an 'any' return type. function f6(x: string, y: string): any; function f6(x: string, y) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~ +!!! error TS7010: 'f6', which lacks return-type annotation, implicitly has an 'any' return type. ~ !!! error TS7006: Parameter 'y' implicitly has an 'any' type. return null; - ~~~~~~~~~~~~~~~~ - } - ~ -!!! error TS7010: 'f6', which lacks return-type annotation, implicitly has an 'any' return type. \ No newline at end of file + } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyModule.errors.txt b/tests/baselines/reference/noImplicitAnyModule.errors.txt index ec1af2346c..cb2dfbe579 100644 --- a/tests/baselines/reference/noImplicitAnyModule.errors.txt +++ b/tests/baselines/reference/noImplicitAnyModule.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/noImplicitAnyModule.ts(5,9): error TS7013: Construct signature, which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/noImplicitAnyModule.ts(10,18): error TS7006: Parameter 'x' implicitly has an 'any' type. tests/cases/compiler/noImplicitAnyModule.ts(11,9): error TS7010: 'g', which lacks return-type annotation, implicitly has an 'any' return type. -tests/cases/compiler/noImplicitAnyModule.ts(18,5): error TS7010: 'f', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyModule.ts(18,14): error TS7010: 'f', which lacks return-type annotation, implicitly has an 'any' return type. ==== tests/cases/compiler/noImplicitAnyModule.ts (4 errors) ==== @@ -29,7 +29,7 @@ tests/cases/compiler/noImplicitAnyModule.ts(18,5): error TS7010: 'f', which lack // Should return error for implicit any on return type. function f(x: number); - ~~~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS7010: 'f', which lacks return-type annotation, implicitly has an 'any' return type. } \ No newline at end of file diff --git a/tests/baselines/reference/noImplicitAnyWithOverloads.errors.txt b/tests/baselines/reference/noImplicitAnyWithOverloads.errors.txt index 21845261f3..806cfd39a3 100644 --- a/tests/baselines/reference/noImplicitAnyWithOverloads.errors.txt +++ b/tests/baselines/reference/noImplicitAnyWithOverloads.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/noImplicitAnyWithOverloads.ts(2,5): error TS7008: Member 'foo' implicitly has an 'any' type. -tests/cases/compiler/noImplicitAnyWithOverloads.ts(6,1): error TS7010: 'callb', which lacks return-type annotation, implicitly has an 'any' return type. -tests/cases/compiler/noImplicitAnyWithOverloads.ts(7,1): error TS7010: 'callb', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyWithOverloads.ts(6,10): error TS7010: 'callb', which lacks return-type annotation, implicitly has an 'any' return type. +tests/cases/compiler/noImplicitAnyWithOverloads.ts(7,10): error TS7010: 'callb', which lacks return-type annotation, implicitly has an 'any' return type. tests/cases/compiler/noImplicitAnyWithOverloads.ts(8,16): error TS7006: Parameter 'a' implicitly has an 'any' type. @@ -13,10 +13,10 @@ tests/cases/compiler/noImplicitAnyWithOverloads.ts(8,16): error TS7006: Paramete interface B { } function callb(lam: (l: A) => void); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS7010: 'callb', which lacks return-type annotation, implicitly has an 'any' return type. function callb(lam: (n: B) => void); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~ !!! error TS7010: 'callb', which lacks return-type annotation, implicitly has an 'any' return type. function callb(a) { } ~ diff --git a/tests/baselines/reference/overloadAssignmentCompat.errors.txt b/tests/baselines/reference/overloadAssignmentCompat.errors.txt index aa25558203..446f9ce614 100644 --- a/tests/baselines/reference/overloadAssignmentCompat.errors.txt +++ b/tests/baselines/reference/overloadAssignmentCompat.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/overloadAssignmentCompat.ts(35,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/overloadAssignmentCompat.ts(35,10): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/compiler/overloadAssignmentCompat.ts (1 errors) ==== @@ -37,7 +37,7 @@ tests/cases/compiler/overloadAssignmentCompat.ts(35,1): error TS2394: Overload s // error - signatures are not assignment compatible function foo():number; - ~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function foo():string { return "a" }; diff --git a/tests/baselines/reference/overloadOnConstConstraintChecks4.errors.txt b/tests/baselines/reference/overloadOnConstConstraintChecks4.errors.txt index 9ac9e2253f..7a8037b3dd 100644 --- a/tests/baselines/reference/overloadOnConstConstraintChecks4.errors.txt +++ b/tests/baselines/reference/overloadOnConstConstraintChecks4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/overloadOnConstConstraintChecks4.ts(9,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/overloadOnConstConstraintChecks4.ts(9,10): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/compiler/overloadOnConstConstraintChecks4.ts (1 errors) ==== @@ -11,7 +11,7 @@ tests/cases/compiler/overloadOnConstConstraintChecks4.ts(9,1): error TS2394: Ove function foo(name: 'hi'): B; function foo(name: 'bye'): C; function foo(name: string): A; // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2394: Overload signature is not compatible with function implementation. function foo(name: any): Z { return null; diff --git a/tests/baselines/reference/overloadOnConstDuplicateOverloads1.errors.txt b/tests/baselines/reference/overloadOnConstDuplicateOverloads1.errors.txt index 4714c06ee7..0f5126b592 100644 --- a/tests/baselines/reference/overloadOnConstDuplicateOverloads1.errors.txt +++ b/tests/baselines/reference/overloadOnConstDuplicateOverloads1.errors.txt @@ -1,13 +1,13 @@ -tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts(1,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts(2,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts(1,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts(2,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. ==== tests/cases/compiler/overloadOnConstDuplicateOverloads1.ts (2 errors) ==== function foo(a: 'hi', x: string); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(a: 'hi', x: string); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(a: any, x: any) { } diff --git a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt index bfdb66aa43..1676a2fb42 100644 --- a/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt +++ b/tests/baselines/reference/overloadOnConstantsInvalidOverload1.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(6,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(7,1): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(6,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(7,10): error TS2381: A signature with an implementation cannot use a string literal type. tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(11,5): error TS2345: Argument of type 'string' is not assignable to parameter of type '"SPAN"'. @@ -10,15 +10,13 @@ tests/cases/compiler/overloadOnConstantsInvalidOverload1.ts(11,5): error TS2345: class Derived3 extends Base { biz() { } } function foo(name: "SPAN"): Derived1; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(name: "DIV"): Derived2 { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - return null; - ~~~~~~~~~~~~~~~~ - } - ~ + ~~~ !!! error TS2381: A signature with an implementation cannot use a string literal type. + return null; + } foo("HI"); ~~~~ diff --git a/tests/baselines/reference/overloadingOnConstants2.errors.txt b/tests/baselines/reference/overloadingOnConstants2.errors.txt index 1d7d2c8eca..c6d6352357 100644 --- a/tests/baselines/reference/overloadingOnConstants2.errors.txt +++ b/tests/baselines/reference/overloadingOnConstants2.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/overloadingOnConstants2.ts(8,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadingOnConstants2.ts(9,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadingOnConstants2.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadingOnConstants2.ts(9,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/compiler/overloadingOnConstants2.ts(15,13): error TS2345: Argument of type 'string' is not assignable to parameter of type '"bye"'. -tests/cases/compiler/overloadingOnConstants2.ts(19,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadingOnConstants2.ts(19,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. ==== tests/cases/compiler/overloadingOnConstants2.ts (4 errors) ==== @@ -13,10 +13,10 @@ tests/cases/compiler/overloadingOnConstants2.ts(19,1): error TS2382: Specialized private y = 1; } function foo(x: "hi", items: string[]): D; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(x: "bye", items: string[]): E; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(x: string, items: string[]): C { return null; @@ -30,7 +30,7 @@ tests/cases/compiler/overloadingOnConstants2.ts(19,1): error TS2382: Specialized //function bar(x: "hi", items: string[]): D; function bar(x: "bye", items: string[]): E; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function bar(x: string, items: string[]): C; function bar(x: string, items: string[]): C { diff --git a/tests/baselines/reference/overloadingOnConstantsInImplementation.errors.txt b/tests/baselines/reference/overloadingOnConstantsInImplementation.errors.txt index e3a8bb0862..19afdb2680 100644 --- a/tests/baselines/reference/overloadingOnConstantsInImplementation.errors.txt +++ b/tests/baselines/reference/overloadingOnConstantsInImplementation.errors.txt @@ -1,17 +1,16 @@ -tests/cases/compiler/overloadingOnConstantsInImplementation.ts(1,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadingOnConstantsInImplementation.ts(2,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/overloadingOnConstantsInImplementation.ts(3,1): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/compiler/overloadingOnConstantsInImplementation.ts(1,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadingOnConstantsInImplementation.ts(2,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/overloadingOnConstantsInImplementation.ts(3,10): error TS2381: A signature with an implementation cannot use a string literal type. ==== tests/cases/compiler/overloadingOnConstantsInImplementation.ts (3 errors) ==== function foo(a: 'hi', x: string); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(a: 'hi', x: string); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(a: 'hi', x: any) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - } - ~ -!!! error TS2381: A signature with an implementation cannot use a string literal type. \ No newline at end of file + ~~~ +!!! error TS2381: A signature with an implementation cannot use a string literal type. + } \ No newline at end of file diff --git a/tests/baselines/reference/parserArgumentList1.errors.txt b/tests/baselines/reference/parserArgumentList1.errors.txt index 5146650dbf..f20b47fa96 100644 --- a/tests/baselines/reference/parserArgumentList1.errors.txt +++ b/tests/baselines/reference/parserArgumentList1.errors.txt @@ -1,21 +1,17 @@ -tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(1,17): error TS1148: Cannot compile external modules unless the '--module' flag is provided. tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(1,35): error TS2304: Cannot find name 'HTMLElement'. tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts(2,42): error TS2304: Cannot find name '_classNameRegexp'. ==== tests/cases/conformance/parser/ecmascript5/parserArgumentList1.ts (3 errors) ==== export function removeClass (node:HTMLElement, className:string) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~~~ +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. ~~~~~~~~~~~ !!! error TS2304: Cannot find name 'HTMLElement'. node.className = node.className.replace(_classNameRegexp(className), function (everything, leftDelimiter, name, rightDelimiter) { - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name '_classNameRegexp'. return leftDelimiter.length + rightDelimiter.length === 2 ? ' ' : ''; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ }); - ~~~~ - } - ~ -!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file + } \ No newline at end of file diff --git a/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt b/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt index 5fa104a0e8..1530281b36 100644 --- a/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt +++ b/tests/baselines/reference/parserModifierOnStatementInBlock1.errors.txt @@ -1,15 +1,13 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts(1,17): error TS1148: Cannot compile external modules unless the '--module' flag is provided. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts(2,4): error TS1184: Modifiers cannot appear here. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock1.ts (2 errors) ==== export function foo() { - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. export var x = this; - ~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS1184: Modifiers cannot appear here. } - ~ -!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file diff --git a/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt b/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt index 5bc5a49670..cff0ba1d50 100644 --- a/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt +++ b/tests/baselines/reference/parserModifierOnStatementInBlock3.errors.txt @@ -1,17 +1,14 @@ -tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided. +tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts(1,17): error TS1148: Cannot compile external modules unless the '--module' flag is provided. tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts(2,4): error TS1184: Modifiers cannot appear here. ==== tests/cases/conformance/parser/ecmascript5/ErrorRecovery/parserModifierOnStatementInBlock3.ts (2 errors) ==== export function foo() { - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ +!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. export function bar() { - ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ !!! error TS1184: Modifiers cannot appear here. } - ~~~~ } - ~ -!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided. \ No newline at end of file diff --git a/tests/baselines/reference/parserParameterList15.errors.txt b/tests/baselines/reference/parserParameterList15.errors.txt index 0b062ee6ee..7a1a8af909 100644 --- a/tests/baselines/reference/parserParameterList15.errors.txt +++ b/tests/baselines/reference/parserParameterList15.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList15.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList15.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList15.ts(1,14): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. ==== tests/cases/conformance/parser/ecmascript5/ParameterLists/parserParameterList15.ts (2 errors) ==== function foo(a = 4); - ~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2394: Overload signature is not compatible with function implementation. ~~~~~ !!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. diff --git a/tests/baselines/reference/parserUnaryExpression2.errors.txt b/tests/baselines/reference/parserUnaryExpression2.errors.txt index 39ebc7eef8..4f9c67a16f 100644 --- a/tests/baselines/reference/parserUnaryExpression2.errors.txt +++ b/tests/baselines/reference/parserUnaryExpression2.errors.txt @@ -3,5 +3,5 @@ tests/cases/conformance/parser/ecmascript5/Expressions/parserUnaryExpression2.ts ==== tests/cases/conformance/parser/ecmascript5/Expressions/parserUnaryExpression2.ts (1 errors) ==== ++function(e) { } - ~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. \ No newline at end of file diff --git a/tests/baselines/reference/recursiveFunctionTypes.errors.txt b/tests/baselines/reference/recursiveFunctionTypes.errors.txt index 30f6c7aa41..c69549403c 100644 --- a/tests/baselines/reference/recursiveFunctionTypes.errors.txt +++ b/tests/baselines/reference/recursiveFunctionTypes.errors.txt @@ -7,7 +7,7 @@ tests/cases/compiler/recursiveFunctionTypes.ts(12,16): error TS2355: A function tests/cases/compiler/recursiveFunctionTypes.ts(17,5): error TS2322: Type '() => I' is not assignable to type 'number'. tests/cases/compiler/recursiveFunctionTypes.ts(22,5): error TS2345: Argument of type 'number' is not assignable to parameter of type '(t: typeof g) => void'. tests/cases/compiler/recursiveFunctionTypes.ts(25,1): error TS2322: Type 'number' is not assignable to type '() => any'. -tests/cases/compiler/recursiveFunctionTypes.ts(30,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/recursiveFunctionTypes.ts(30,10): error TS2394: Overload signature is not compatible with function implementation. tests/cases/compiler/recursiveFunctionTypes.ts(33,1): error TS2346: Supplied parameters do not match any signature of call target. tests/cases/compiler/recursiveFunctionTypes.ts(34,4): error TS2345: Argument of type 'string' is not assignable to parameter of type '{ (): typeof f6; (a: typeof f6): () => number; }'. tests/cases/compiler/recursiveFunctionTypes.ts(42,1): error TS2346: Supplied parameters do not match any signature of call target. @@ -62,7 +62,7 @@ tests/cases/compiler/recursiveFunctionTypes.ts(43,4): error TS2345: Argument of function f6(): typeof f6; function f6(a: typeof f6): () => number; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS2394: Overload signature is not compatible with function implementation. function f6(a?: any) { return f6; } diff --git a/tests/baselines/reference/specializedOverloadWithRestParameters.errors.txt b/tests/baselines/reference/specializedOverloadWithRestParameters.errors.txt index e7272aeaf8..0e67cc37f3 100644 --- a/tests/baselines/reference/specializedOverloadWithRestParameters.errors.txt +++ b/tests/baselines/reference/specializedOverloadWithRestParameters.errors.txt @@ -1,19 +1,19 @@ -tests/cases/compiler/specializedOverloadWithRestParameters.ts(3,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/compiler/specializedOverloadWithRestParameters.ts(8,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/specializedOverloadWithRestParameters.ts(3,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/compiler/specializedOverloadWithRestParameters.ts(8,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. ==== tests/cases/compiler/specializedOverloadWithRestParameters.ts (2 errors) ==== class Base { foo() { } } class Derived1 extends Base { bar() { } } function f(tagName: 'span', ...args): Derived1; // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function f(tagName: number, ...args): Base; function f(tagName: any): Base { return null; } function g(tagName: 'span', arg): Derived1; // error - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function g(tagName: number, arg): Base; function g(tagName: any): Base { diff --git a/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt b/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt index f5883a17d7..6b705a0c34 100644 --- a/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt +++ b/tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(4,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(4,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(8,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(14,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(20,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. @@ -17,7 +17,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignat // All the below should be errors function foo(x: 'a'); - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function foo(x: number) { } diff --git a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.errors.txt b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.errors.txt index d9e01d9ccc..b82fa1c93e 100644 --- a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.errors.txt +++ b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.errors.txt @@ -1,10 +1,10 @@ -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(22,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(26,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(30,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(34,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(38,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(76,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. -tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(89,1): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(22,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(26,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(30,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(34,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(38,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(76,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. +tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(89,10): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(93,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(94,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLiteralTypeIsSubtypeOfString.ts(95,17): error TS2313: Constraint of a type parameter cannot reference any type parameter from the same type parameter list. @@ -36,31 +36,31 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLite function f4(x: any) { } function f5(x: 'a'); - ~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function f5(x: number); function f5(x: any) { } function f6(x: 'a'); - ~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function f6(x: boolean); function f6(x: any) { } function f7(x: 'a'); - ~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function f7(x: Date); function f7(x: any) { } function f8(x: 'a'); - ~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function f8(x: RegExp); function f8(x: any) { } function f9(x: 'a'); - ~~~~~~~~~~~~~~~~~~~~ + ~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function f9(x: () => {}); function f9(x: any) { } @@ -100,7 +100,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLite // BUG 831846 function f11(x: 'a'); - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function f11(x: I); function f11(x: any) { } @@ -115,7 +115,7 @@ tests/cases/conformance/types/typeRelationships/subtypesAndSuperTypes/stringLite enum E { A } function f14(x: 'a'); - ~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature. function f14(x: E); function f14(x: any) { } diff --git a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.errors.txt b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.errors.txt index a2404ac648..b89553fcf5 100644 --- a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(3,1): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(4,9): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(3,10): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(4,18): error TS2381: A signature with an implementation cannot use a string literal type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(5,10): error TS2381: A signature with an implementation cannot use a string literal type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(8,5): error TS2381: A signature with an implementation cannot use a string literal type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(12,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. @@ -7,7 +7,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralType tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(17,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(18,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(22,5): error TS2381: A signature with an implementation cannot use a string literal type. -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(23,8): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(23,17): error TS2381: A signature with an implementation cannot use a string literal type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts(24,8): error TS2381: A signature with an implementation cannot use a string literal type. @@ -15,10 +15,10 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralType // String literal types are only valid in overload signatures function foo(x: 'hi') { } - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2381: A signature with an implementation cannot use a string literal type. var f = function foo(x: 'hi') { } - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2381: A signature with an implementation cannot use a string literal type. var f2 = (x: 'hi', y: 'hi') => { } ~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -53,7 +53,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralType ~~~~~~~~~~~~~~~~ !!! error TS2381: A signature with an implementation cannot use a string literal type. a: function foo(x: 'hi', y: 'hi') { }, - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2381: A signature with an implementation cannot use a string literal type. b: (x: 'hi') => { } ~~~~~~~~~~~~~~~~ diff --git a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt index 3cc172c96d..8d296e68a1 100644 --- a/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt +++ b/tests/baselines/reference/stringLiteralTypesInImplementationSignatures2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(4,1): error TS2381: A signature with an implementation cannot use a string literal type. +tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(4,10): error TS2381: A signature with an implementation cannot use a string literal type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(8,5): error TS2381: A signature with an implementation cannot use a string literal type. tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(12,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures2.ts(13,5): error TS2382: Specialized overload signature is not assignable to any non-specialized signature. @@ -19,7 +19,7 @@ tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralType function foo(x: any); function foo(x: 'hi') { } - ~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ !!! error TS2381: A signature with an implementation cannot use a string literal type. class C { diff --git a/tests/baselines/reference/targetTypeVoidFunc.errors.txt b/tests/baselines/reference/targetTypeVoidFunc.errors.txt index 14c3cb37c3..f9434c1d63 100644 --- a/tests/baselines/reference/targetTypeVoidFunc.errors.txt +++ b/tests/baselines/reference/targetTypeVoidFunc.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/targetTypeVoidFunc.ts(2,12): error TS2322: Type '() => void ==== tests/cases/compiler/targetTypeVoidFunc.ts (1 errors) ==== function f1(): { new (): number; } { return function () { return; } - ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~ !!! error TS2322: Type '() => void' is not assignable to type 'new () => number'. }; diff --git a/tests/baselines/reference/templateStringInFunctionParameterType.errors.txt b/tests/baselines/reference/templateStringInFunctionParameterType.errors.txt index 1f93a38e19..e523b4c2dc 100644 --- a/tests/baselines/reference/templateStringInFunctionParameterType.errors.txt +++ b/tests/baselines/reference/templateStringInFunctionParameterType.errors.txt @@ -1,15 +1,15 @@ -tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,12): error TS1138: Parameter declaration expected. tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts(1,19): error TS1005: ';' expected. ==== tests/cases/conformance/es6/templates/templateStringInFunctionParameterType.ts (4 errors) ==== function f(`hello`); - ~~~~~~~~~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. ~ !!! error TS2391: Function implementation is missing or not immediately following the declaration. + ~ +!!! error TS2394: Overload signature is not compatible with function implementation. ~~~~~~~ !!! error TS1138: Parameter declaration expected. ~ diff --git a/tests/baselines/reference/templateStringInFunctionParameterTypeES6.errors.txt b/tests/baselines/reference/templateStringInFunctionParameterTypeES6.errors.txt index af911f07e7..be9c3556ca 100644 --- a/tests/baselines/reference/templateStringInFunctionParameterTypeES6.errors.txt +++ b/tests/baselines/reference/templateStringInFunctionParameterTypeES6.errors.txt @@ -1,15 +1,15 @@ -tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,10): error TS2391: Function implementation is missing or not immediately following the declaration. +tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,10): error TS2394: Overload signature is not compatible with function implementation. tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,12): error TS1138: Parameter declaration expected. tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts(1,19): error TS1005: ';' expected. ==== tests/cases/conformance/es6/templates/templateStringInFunctionParameterTypeES6.ts (4 errors) ==== function f(`hello`); - ~~~~~~~~~~~ -!!! error TS2394: Overload signature is not compatible with function implementation. ~ !!! error TS2391: Function implementation is missing or not immediately following the declaration. + ~ +!!! error TS2394: Overload signature is not compatible with function implementation. ~~~~~~~ !!! error TS1138: Parameter declaration expected. ~ diff --git a/tests/baselines/reference/voidAsNonAmbiguousReturnType.errors.txt b/tests/baselines/reference/voidAsNonAmbiguousReturnType.errors.txt index 76d158f7de..aa61a11414 100644 --- a/tests/baselines/reference/voidAsNonAmbiguousReturnType.errors.txt +++ b/tests/baselines/reference/voidAsNonAmbiguousReturnType.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/voidAsNonAmbiguousReturnType_0.ts(1,1): error TS2394: Overload signature is not compatible with function implementation. +tests/cases/compiler/voidAsNonAmbiguousReturnType_0.ts(1,17): error TS2394: Overload signature is not compatible with function implementation. ==== tests/cases/compiler/voidAsNonAmbiguousReturnType_1.ts (0 errors) ==== @@ -11,7 +11,7 @@ tests/cases/compiler/voidAsNonAmbiguousReturnType_0.ts(1,1): error TS2394: Overl ==== tests/cases/compiler/voidAsNonAmbiguousReturnType_0.ts (1 errors) ==== export function mkdirSync(path: string, mode?: number): void; - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~~~~~~~ !!! error TS2394: Overload signature is not compatible with function implementation. export function mkdirSync(path: string, mode?: string): void {} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithNoBestCommonType1.ts b/tests/cases/compiler/functionWithNoBestCommonType1.ts new file mode 100644 index 0000000000..1162881292 --- /dev/null +++ b/tests/cases/compiler/functionWithNoBestCommonType1.ts @@ -0,0 +1,7 @@ +function foo() { + return true; + return bar(); +} + +function bar(): void { +} \ No newline at end of file diff --git a/tests/cases/compiler/functionWithNoBestCommonType2.ts b/tests/cases/compiler/functionWithNoBestCommonType2.ts new file mode 100644 index 0000000000..974ccdfe03 --- /dev/null +++ b/tests/cases/compiler/functionWithNoBestCommonType2.ts @@ -0,0 +1,7 @@ +var v = function () { + return true; + return bar(); +}; + +function bar(): void { +} \ No newline at end of file From d367c96df6ea716d8e4f3b1a8485d99da3a7abd3 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 4 Mar 2015 18:37:50 -0800 Subject: [PATCH 04/14] CR feedback. --- src/compiler/utilities.ts | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index f2687a151a..30eda5efd2 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -236,10 +236,6 @@ module ts { }; } - interface FileTextRange extends TextRange { - sourceFile: SourceFile; - } - /* @internal */ export function getSpanOfTokenAtPosition(sourceFile: SourceFile, pos: number): TextSpan { var scanner = createScanner(sourceFile.languageVersion, /*skipTrivia*/ true, sourceFile.text); @@ -250,7 +246,7 @@ module ts { } export function getErrorSpanForNode(sourceFile: SourceFile, node: Node): TextSpan { - var errorNode: Node; + var errorNode = node; switch (node.kind) { // This list is a work in progress. Add missing node kinds to improve their error // spans. @@ -267,24 +263,12 @@ module ts { break; } - if (node.kind === SyntaxKind.FunctionExpression) { - var functionExpression = node; - if (nodeIsMissing(functionExpression.name)) { - // If it's an anonymous function expression, put the error on the first token. - return getSpanOfTokenAtPosition(sourceFile, node.pos); - } - else { - errorNode = functionExpression.name; - } + if (errorNode === undefined) { + // If we don't have a better node, then just set the error on the first token of + // construct. + return getSpanOfTokenAtPosition(sourceFile, node.pos); } - // We now have the ideal error span, but it may be a node that is optional and absent - // (e.g. the name of a function expression), in which case errorSpan will be undefined. - // Alternatively, it might be required and missing (e.g. the name of a module), in which - // case its pos will equal its end (length 0). In either of these cases, we should fall - // back to the original node that the error was issued on. - errorNode = nodeIsMissing(errorNode) ? node : errorNode; - var pos = nodeIsMissing(errorNode) ? errorNode.pos : skipTrivia(sourceFile.text, errorNode.pos); From 02eb7466a7a5aeb6d83c0e87210aefa80cc4e767 Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Thu, 5 Mar 2015 23:32:54 -0800 Subject: [PATCH 05/14] Fix watch to honor tsconfig.json setting --- src/compiler/tsc.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/compiler/tsc.ts b/src/compiler/tsc.ts index 57c2298d3d..c4422e12bf 100644 --- a/src/compiler/tsc.ts +++ b/src/compiler/tsc.ts @@ -250,7 +250,7 @@ module ts { var compileResult = compile(rootFileNames, compilerOptions, compilerHost); - if (!commandLine.options.watch) { + if (!compilerOptions.watch) { return sys.exit(compileResult.exitStatus); } @@ -269,7 +269,7 @@ module ts { } // Use default host function var sourceFile = hostGetSourceFile(fileName, languageVersion, onError); - if (sourceFile && commandLine.options.watch) { + if (sourceFile && compilerOptions.watch) { // Attach a file watcher sourceFile.fileWatcher = sys.watchFile(sourceFile.fileName, () => sourceFileChanged(sourceFile)); } From ee912ee1cd1f7d83f07d1e6a06ef94f5a06791c1 Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Thu, 5 Mar 2015 22:57:11 -0800 Subject: [PATCH 06/14] Fix path normalization for patterns such as './/tsconfig.json' --- src/compiler/core.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compiler/core.ts b/src/compiler/core.ts index 2518b95d37..1fb73c9069 100644 --- a/src/compiler/core.ts +++ b/src/compiler/core.ts @@ -430,7 +430,11 @@ module ts { normalized.pop(); } else { - normalized.push(part); + // A part may be an empty string (which is 'falsy') if the path had consecutive slashes, + // e.g. "path//file.ts". Drop these before re-joining the parts. + if(part) { + normalized.push(part); + } } } } From 5ca703eeb4315b2ba9deb2dd642f38f84964b915 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Mar 2015 20:53:15 +0100 Subject: [PATCH 07/14] Add new diagnostics message for let/const declarations in a catch clause --- src/compiler/diagnosticInformationMap.generated.ts | 1 + src/compiler/diagnosticMessages.json | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/src/compiler/diagnosticInformationMap.generated.ts b/src/compiler/diagnosticInformationMap.generated.ts index 477fd5d46a..f616de8bd4 100644 --- a/src/compiler/diagnosticInformationMap.generated.ts +++ b/src/compiler/diagnosticInformationMap.generated.ts @@ -337,6 +337,7 @@ module ts { The_iterator_returned_by_the_right_hand_side_of_a_for_of_statement_must_have_a_next_method: { code: 2489, category: DiagnosticCategory.Error, key: "The iterator returned by the right-hand side of a 'for...of' statement must have a 'next()' method." }, The_type_returned_by_the_next_method_of_an_iterator_must_have_a_value_property: { code: 2490, category: DiagnosticCategory.Error, key: "The type returned by the 'next()' method of an iterator must have a 'value' property." }, The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern: { code: 2491, category: DiagnosticCategory.Error, key: "The left-hand side of a 'for...in' statement cannot be a destructuring pattern." }, + Cannot_redeclare_identifier_0_in_catch_clause: { code: 2492, category: DiagnosticCategory.Error, key: "Cannot redeclare identifier '{0}' in catch clause" }, Import_declaration_0_is_using_private_name_1: { code: 4000, category: DiagnosticCategory.Error, key: "Import declaration '{0}' is using private name '{1}'." }, Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: { code: 4002, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported class has or is using private name '{1}'." }, Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: { code: 4004, category: DiagnosticCategory.Error, key: "Type parameter '{0}' of exported interface has or is using private name '{1}'." }, diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index da153903b8..ddd3f72aaf 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1339,6 +1339,10 @@ "category": "Error", "code": 2491 }, + "Cannot redeclare identifier '{0}' in catch clause": { + "category": "Error", + "code": 2492 + }, "Import declaration '{0}' is using private name '{1}'.": { "category": "Error", From b4d723217e67c63addfae44b0592b8bcfc28f22a Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Mar 2015 21:42:42 +0100 Subject: [PATCH 08/14] Error on redeclaring a variable with let/const already defined as catch parameter --- src/compiler/checker.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 7220182bfe..4281d8a5bd 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9158,6 +9158,15 @@ module ts { grammarErrorOnFirstToken(catchClause.variableDeclaration.initializer, Diagnostics.Catch_clause_variable_cannot_have_an_initializer); } else { + var identifierName = (catchClause.variableDeclaration.name).text; + var locals = catchClause.block.locals; + if (locals && locals[identifierName]) { + var localSymbol = locals[identifierName] + if (localSymbol && (localSymbol.flags & SymbolFlags.BlockScopedVariable) !== 0) { + grammarErrorOnNode(localSymbol.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, identifierName); + } + } + // It is a SyntaxError if a TryStatement with a Catch occurs within strict code and the Identifier of the // Catch production is eval or arguments checkGrammarEvalOrArgumentsInStrictMode(node, catchClause.variableDeclaration.name); From 0ba3a04c5492b011fb265b6d69d602aa15fa46bb Mon Sep 17 00:00:00 2001 From: Bill Ticehurst Date: Fri, 6 Mar 2015 13:37:12 -0800 Subject: [PATCH 09/14] Fixed baselines to account for correct path normalization --- .../amd/{diskFile1.d.ts => test.d.ts} | 0 .../amd/{diskFile0.js => test.js} | 0 .../node/{diskFile1.d.ts => test.d.ts} | 0 .../node/{diskFile0.js => test.js} | 0 .../amd/{diskFile1.d.ts => test.d.ts} | 0 .../amd/{diskFile0.js => test.js} | 0 .../node/{diskFile1.d.ts => test.d.ts} | 0 .../node/{diskFile0.js => test.js} | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/{diskFile1.d.ts => test.d.ts} (100%) rename tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/{diskFile0.js => test.js} (100%) rename tests/baselines/reference/project/referenceResolutionSameFileTwice/node/{diskFile1.d.ts => test.d.ts} (100%) rename tests/baselines/reference/project/referenceResolutionSameFileTwice/node/{diskFile0.js => test.js} (100%) rename tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/{diskFile1.d.ts => test.d.ts} (100%) rename tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/{diskFile0.js => test.js} (100%) rename tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/{diskFile1.d.ts => test.d.ts} (100%) rename tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/{diskFile0.js => test.js} (100%) diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/test.d.ts similarity index 100% rename from tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/diskFile1.d.ts rename to tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/test.d.ts diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/diskFile0.js b/tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/test.js similarity index 100% rename from tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/diskFile0.js rename to tests/baselines/reference/project/referenceResolutionSameFileTwice/amd/test.js diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/test.d.ts similarity index 100% rename from tests/baselines/reference/project/referenceResolutionSameFileTwice/node/diskFile1.d.ts rename to tests/baselines/reference/project/referenceResolutionSameFileTwice/node/test.d.ts diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/diskFile0.js b/tests/baselines/reference/project/referenceResolutionSameFileTwice/node/test.js similarity index 100% rename from tests/baselines/reference/project/referenceResolutionSameFileTwice/node/diskFile0.js rename to tests/baselines/reference/project/referenceResolutionSameFileTwice/node/test.js diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/test.d.ts similarity index 100% rename from tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/diskFile1.d.ts rename to tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/test.d.ts diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/diskFile0.js b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/test.js similarity index 100% rename from tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/diskFile0.js rename to tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/amd/test.js diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/diskFile1.d.ts b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/test.d.ts similarity index 100% rename from tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/diskFile1.d.ts rename to tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/test.d.ts diff --git a/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/diskFile0.js b/tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/test.js similarity index 100% rename from tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/diskFile0.js rename to tests/baselines/reference/project/referenceResolutionSameFileTwiceNoResolve/node/test.js From 129ef7222c00706c2cb3fc31893f309db231f934 Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Mar 2015 22:56:59 +0100 Subject: [PATCH 10/14] Use hasProperty instead --- src/compiler/checker.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 4281d8a5bd..98cfac70be 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -9160,7 +9160,7 @@ module ts { else { var identifierName = (catchClause.variableDeclaration.name).text; var locals = catchClause.block.locals; - if (locals && locals[identifierName]) { + if (locals && hasProperty(locals, identifierName)) { var localSymbol = locals[identifierName] if (localSymbol && (localSymbol.flags & SymbolFlags.BlockScopedVariable) !== 0) { grammarErrorOnNode(localSymbol.valueDeclaration, Diagnostics.Cannot_redeclare_identifier_0_in_catch_clause, identifierName); From 2edb5c88d841750e774769f3cbbc7b126de8aeeb Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 6 Mar 2015 23:00:43 +0100 Subject: [PATCH 11/14] Added tests for let/const variable declarations in catch clause (with the same name) --- .../redeclareParameterInCatchBlock.errors.txt | 31 ++++++++++++++ .../redeclareParameterInCatchBlock.js | 42 +++++++++++++++++++ .../redeclareParameterInCatchBlock.ts | 22 ++++++++++ 3 files changed, 95 insertions(+) create mode 100644 tests/baselines/reference/redeclareParameterInCatchBlock.errors.txt create mode 100644 tests/baselines/reference/redeclareParameterInCatchBlock.js create mode 100644 tests/cases/compiler/redeclareParameterInCatchBlock.ts diff --git a/tests/baselines/reference/redeclareParameterInCatchBlock.errors.txt b/tests/baselines/reference/redeclareParameterInCatchBlock.errors.txt new file mode 100644 index 0000000000..07dbbefefe --- /dev/null +++ b/tests/baselines/reference/redeclareParameterInCatchBlock.errors.txt @@ -0,0 +1,31 @@ +tests/cases/compiler/redeclareParameterInCatchBlock.ts(5,11): error TS2492: Cannot redeclare identifier 'e' in catch clause +tests/cases/compiler/redeclareParameterInCatchBlock.ts(11,9): error TS2492: Cannot redeclare identifier 'e' in catch clause + + +==== tests/cases/compiler/redeclareParameterInCatchBlock.ts (2 errors) ==== + + try { + + } catch(e) { + const e = null; + ~ +!!! error TS2492: Cannot redeclare identifier 'e' in catch clause + } + + try { + + } catch(e) { + let e; + ~ +!!! error TS2492: Cannot redeclare identifier 'e' in catch clause + } + + try { + + } catch(e) { + function test() { + let e; + } + } + + \ No newline at end of file diff --git a/tests/baselines/reference/redeclareParameterInCatchBlock.js b/tests/baselines/reference/redeclareParameterInCatchBlock.js new file mode 100644 index 0000000000..a187e2fcf0 --- /dev/null +++ b/tests/baselines/reference/redeclareParameterInCatchBlock.js @@ -0,0 +1,42 @@ +//// [redeclareParameterInCatchBlock.ts] + +try { + +} catch(e) { + const e = null; +} + +try { + +} catch(e) { + let e; +} + +try { + +} catch(e) { + function test() { + let e; + } +} + + + +//// [redeclareParameterInCatchBlock.js] +try { +} +catch (e) { + const e = null; +} +try { +} +catch (e) { + let e; +} +try { +} +catch (e) { + function test() { + let e; + } +} diff --git a/tests/cases/compiler/redeclareParameterInCatchBlock.ts b/tests/cases/compiler/redeclareParameterInCatchBlock.ts new file mode 100644 index 0000000000..37ca5fc3a9 --- /dev/null +++ b/tests/cases/compiler/redeclareParameterInCatchBlock.ts @@ -0,0 +1,22 @@ +// @target: es6 + +try { + +} catch(e) { + const e = null; +} + +try { + +} catch(e) { + let e; +} + +try { + +} catch(e) { + function test() { + let e; + } +} + From e9cb12aeab1241a520164221999d0916500df9f3 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Fri, 6 Mar 2015 14:29:23 -0800 Subject: [PATCH 12/14] Add diagnostics for signaturehelp crash --- src/services/signatureHelp.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 8b7dea13ea..e5ddb9012c 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -264,12 +264,16 @@ module ts.SignatureHelp { // the comma. That amounts to taking the ceiling of half the index. var argumentIndex = (listItemInfo.listItemIndex + 1) >> 1; + var argumentCount = getCommaBasedArgCount(list); + + Debug.assert(argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); + return { kind: isTypeArgList ? ArgumentListKind.TypeArguments : ArgumentListKind.CallArguments, invocation: callExpression, argumentsSpan: getApplicableSpanForArguments(list), argumentIndex: argumentIndex, - argumentCount: getCommaBasedArgCount(list) + argumentCount: argumentCount }; } } @@ -347,6 +351,8 @@ module ts.SignatureHelp { ? 1 : (tagExpression.template).templateSpans.length + 1; + Debug.assert(argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); + return { kind: ArgumentListKind.TaggedTemplateArguments, invocation: tagExpression, @@ -512,6 +518,8 @@ module ts.SignatureHelp { selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount); } + Debug.assert(argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); + return { items, applicableSpan, From 564dd2eb4af257e84c67610af202ba76f40da964 Mon Sep 17 00:00:00 2001 From: Caitlin Potter Date: Fri, 6 Mar 2015 18:07:02 -0500 Subject: [PATCH 13/14] Document procedure for digital CLA signature in CONTRIBUTING.md Closes #2237 --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a30b215413..92eb646f48 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,7 @@ Design changes will not be accepted at this time. If you have a design change pr ## Legal You will need to complete a Contributor License Agreement (CLA). Briefly, this agreement testifies that you are granting us permission to use the submitted change according to the terms of the project's license, and that the work being submitted is under appropriate copyright. -Please submit a Contributor License Agreement (CLA) before submitting a pull request. Download the agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190) or [Microsoft Contribution License Agreement.pdf](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=921298)), sign, scan, and email it back to . Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request. Please note that we're currently only accepting pull requests of bug fixes rather than new features. +Please submit a Contributor License Agreement (CLA) before submitting a pull request. You may visit https://cla.microsoft.com to sign digitally. Alternatively, download the agreement ([Microsoft Contribution License Agreement.docx](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=822190) or [Microsoft Contribution License Agreement.pdf](https://www.codeplex.com/Download?ProjectName=typescript&DownloadId=921298)), sign, scan, and email it back to . Be sure to include your github user name along with the agreement. Once we have received the signed CLA, we'll review the request. Please note that we're currently only accepting pull requests of bug fixes rather than new features. ## Housekeeping Your pull request should: From 80f9cf299c250b46205ba2770dd7175e6a7f01f1 Mon Sep 17 00:00:00 2001 From: Paul van Brenk Date: Fri, 6 Mar 2015 15:09:19 -0800 Subject: [PATCH 14/14] fix check to allow for empty argument list --- src/services/signatureHelp.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/services/signatureHelp.ts b/src/services/signatureHelp.ts index 7686bb470e..6f4f38aa73 100644 --- a/src/services/signatureHelp.ts +++ b/src/services/signatureHelp.ts @@ -266,7 +266,7 @@ module ts.SignatureHelp { var argumentCount = getCommaBasedArgCount(list); - Debug.assert(argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); + Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); return { kind: isTypeArgList ? ArgumentListKind.TypeArguments : ArgumentListKind.CallArguments, @@ -351,7 +351,7 @@ module ts.SignatureHelp { ? 1 : (tagExpression.template).templateSpans.length + 1; - Debug.assert(argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); + Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); return { kind: ArgumentListKind.TaggedTemplateArguments, @@ -518,7 +518,7 @@ module ts.SignatureHelp { selectedItemIndex = selectBestInvalidOverloadIndex(candidates, argumentCount); } - Debug.assert(argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); + Debug.assert(argumentIndex === 0 || argumentIndex < argumentCount, `argumentCount < argumentIndex, ${argumentCount} < ${argumentIndex}`); return { items,