From 0e6c4b3e0f13ba163c1dc3c60de31c24bcbb366f Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Thu, 19 Oct 2017 14:03:13 -0700 Subject: [PATCH 1/2] Subsequent variable declarations must have same type: Mention location of other declaration --- src/compiler/checker.ts | 26 +++++++--- src/compiler/diagnosticMessages.json | 2 +- src/compiler/utilities.ts | 8 ++-- .../baselines/reference/ES5For-of7.errors.txt | 4 +- ...ModuleWithSameNameAndCommonRoot.errors.txt | 8 ++-- .../asyncArrowFunction5_es2017.errors.txt | 4 +- .../asyncArrowFunction5_es5.errors.txt | 4 +- .../asyncArrowFunction5_es6.errors.txt | 4 +- .../asyncArrowFunction9_es2017.errors.txt | 4 +- .../asyncArrowFunction9_es5.errors.txt | 4 +- .../asyncArrowFunction9_es6.errors.txt | 4 +- .../reference/augmentedTypesVar.errors.txt | 4 +- .../reference/castingTuple.errors.txt | 4 +- .../classWithDuplicateIdentifier.errors.txt | 4 +- .../declarationsAndAssignments.errors.txt | 4 +- .../duplicateClassElements.errors.txt | 4 +- ...duplicateIdentifierInCatchBlock.errors.txt | 4 +- .../duplicateLocalVariable1.errors.txt | 4 +- .../duplicateLocalVariable2.errors.txt | 4 +- .../duplicateLocalVariable3.errors.txt | 4 +- .../duplicateLocalVariable4.errors.txt | 4 +- .../duplicateVariablesWithAny.errors.txt | 16 +++---- ...plicateVarsAcrossFileBoundaries.errors.txt | 16 +++---- .../enumAssignabilityInInheritance.errors.txt | 8 ++-- .../reference/for-inStatements.errors.txt | 8 ++-- .../for-inStatementsArrayErrors.errors.txt | 8 ++-- .../for-inStatementsInvalid.errors.txt | 8 ++-- ...orStatementsMultipleInvalidDecl.errors.txt | 48 +++++++++---------- .../reference/functionArgShadowing.errors.txt | 8 ++-- .../gettersAndSettersErrors.errors.txt | 4 +- ...naturesWithTypeParametersAndAny.errors.txt | 16 +++---- .../interfaceDeclaration1.errors.txt | 4 +- ...lidMultipleVariableDeclarations.errors.txt | 48 +++++++++---------- ...nDuplicateVariableErrorReported.errors.txt | 4 +- .../reference/mappedTypeErrors.errors.txt | 16 +++---- ...cesWithConflictingPropertyNames.errors.txt | 12 ++--- .../missingAndExcessProperties.errors.txt | 16 +++---- ...cStringNamedPropertyEquivalence.errors.txt | 4 +- ...ParamterAndVariableDeclaration2.errors.txt | 4 +- ...attersForSignatureGroupIdentity.errors.txt | 4 +- .../reference/overloadResolution.errors.txt | 4 +- .../overloadResolutionConstructors.errors.txt | 4 +- .../parserCastVersusArrowFunction1.errors.txt | 12 ++--- .../reference/promiseIdentity2.errors.txt | 4 +- .../promiseIdentityWithAny2.errors.txt | 8 ++-- .../reference/propertyAccess.errors.txt | 4 +- ...ertyIdentityWithPrivacyMismatch.errors.txt | 8 ++-- .../reference/reassignStaticProp.errors.txt | 4 +- ...FormTypeOfEqualEqualHasNoEffect.errors.txt | 16 +++---- ...OfFormTypeOfNotEqualHasNoEffect.errors.txt | 16 +++---- .../typeOfEnumAndVarRedeclarations.errors.txt | 8 ++-- .../baselines/reference/typeOfThis.errors.txt | 40 ++++++++-------- .../reference/unionTypeEquivalence.errors.txt | 4 +- .../reference/unionTypeIdentity.errors.txt | 12 ++--- .../reference/unionTypeLiterals.errors.txt | 8 ++-- tests/baselines/reference/varBlock.errors.txt | 4 +- tests/baselines/reference/witness.errors.txt | 28 +++++------ 57 files changed, 281 insertions(+), 267 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 09cddc53c10e5..a9855f8d84f57 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -560,10 +560,10 @@ namespace ts { return emitResolver; } - function error(location: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number): void { + function error(location: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): void { const diagnostic = location - ? createDiagnosticForNode(location, message, arg0, arg1, arg2) - : createCompilerDiagnostic(message, arg0, arg1, arg2); + ? createDiagnosticForNode(location, message, arg0, arg1, arg2, arg3) + : createCompilerDiagnostic(message, arg0, arg1, arg2, arg3); diagnostics.add(diagnostic); } @@ -4417,8 +4417,7 @@ namespace ts { jsDocType = declarationType; } else if (jsDocType !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(jsDocType, declarationType)) { - const name = getNameOfDeclaration(declaration); - error(name, Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, declarationNameToString(name), typeToString(jsDocType), typeToString(declarationType)); + errorSubsequentVariableDeclarationMustHaveSameType(symbol.valueDeclaration, jsDocType, declaration, declarationType); } } else if (!jsDocType) { @@ -20779,7 +20778,7 @@ namespace ts { // initializer is consistent with type associated with the node const declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node)); if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) { - error(node.name, Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2, declarationNameToString(node.name), typeToString(type), typeToString(declarationType)); + errorSubsequentVariableDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType); } if (node.initializer) { checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); @@ -20803,6 +20802,21 @@ namespace ts { } } + function errorSubsequentVariableDeclarationMustHaveSameType(firstDeclaration: Declaration, firstType: Type, nextDeclaration: Declaration, subsequentType: Type): void { + const valueDeclarationSourceFile = getSourceFileOfNode(firstDeclaration); + const otherSpan = getErrorSpanForNode(valueDeclarationSourceFile, getNameOfDeclaration(firstDeclaration) || firstDeclaration); + const otherLocation = getLineAndCharacterOfPosition(valueDeclarationSourceFile, otherSpan.start); + const otherLocationDescription = `${valueDeclarationSourceFile.fileName} ${otherLocation.line}:${otherLocation.character}`; + const nextDeclarationName = getNameOfDeclaration(nextDeclaration); + error( + nextDeclarationName, + Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_has_type_1_at_2_but_here_has_type_3, + declarationNameToString(nextDeclarationName), + typeToString(firstType), + otherLocationDescription, + typeToString(subsequentType)); + } + function areDeclarationFlagsIdentical(left: Declaration, right: Declaration) { if ((left.kind === SyntaxKind.Parameter && right.kind === SyntaxKind.VariableDeclaration) || (left.kind === SyntaxKind.VariableDeclaration && right.kind === SyntaxKind.Parameter)) { diff --git a/src/compiler/diagnosticMessages.json b/src/compiler/diagnosticMessages.json index f33cc4449f936..3b6ecffcfba4a 100644 --- a/src/compiler/diagnosticMessages.json +++ b/src/compiler/diagnosticMessages.json @@ -1316,7 +1316,7 @@ "category": "Error", "code": 2402 }, - "Subsequent variable declarations must have the same type. Variable '{0}' must be of type '{1}', but here has type '{2}'.": { + "Subsequent variable declarations must have the same type. Variable '{0}' has type '{1}' at {2}, but here has type '{3}'.": { "category": "Error", "code": 2403 }, diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 980a8cc61c47e..8020e4bc8a132 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -582,14 +582,14 @@ namespace ts { } } - export function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number): Diagnostic { + export function createDiagnosticForNode(node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): Diagnostic { const sourceFile = getSourceFileOfNode(node); - return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2); + return createDiagnosticForNodeInSourceFile(sourceFile, node, message, arg0, arg1, arg2, arg3); } - export function createDiagnosticForNodeInSourceFile(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number): Diagnostic { + export function createDiagnosticForNodeInSourceFile(sourceFile: SourceFile, node: Node, message: DiagnosticMessage, arg0?: string | number, arg1?: string | number, arg2?: string | number, arg3?: string | number): Diagnostic { const span = getErrorSpanForNode(sourceFile, node); - return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2); + return createFileDiagnostic(sourceFile, span.start, span.length, message, arg0, arg1, arg2, arg3); } export function createDiagnosticForNodeFromMessageChain(node: Node, messageChain: DiagnosticMessageChain): Diagnostic { diff --git a/tests/baselines/reference/ES5For-of7.errors.txt b/tests/baselines/reference/ES5For-of7.errors.txt index a3d40f3881416..082b0d1855487 100644 --- a/tests/baselines/reference/ES5For-of7.errors.txt +++ b/tests/baselines/reference/ES5For-of7.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(6,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'any[]'. +tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(6,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts 1:8, but here has type 'any[]'. ==== tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts (1 errors) ==== @@ -9,5 +9,5 @@ tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts(6,9): error TS for (var v of []) { var x = [w, v]; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'any[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/conformance/statements/for-ofStatements/ES5For-of7.ts 1:8, but here has type 'any[]'. } \ No newline at end of file diff --git a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt index 20f8e09248ad2..85f156a2b0713 100644 --- a/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt +++ b/tests/baselines/reference/FunctionAndModuleWithSameNameAndCommonRoot.errors.txt @@ -1,6 +1,6 @@ tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged. -tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'. -tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'. +tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' has type '() => { x: number; y: number; }' at tests/cases/conformance/internalModules/DeclarationMerging/test.ts 0:4, but here has type 'typeof Point'. +tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' has type '() => { x: number; y: number; }' at tests/cases/conformance/internalModules/DeclarationMerging/test.ts 0:4, but here has type 'typeof Point'. ==== tests/cases/conformance/internalModules/DeclarationMerging/function.ts (0 errors) ==== @@ -23,7 +23,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error T var fn: () => { x: number; y: number }; var fn = A.Point; ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' has type '() => { x: number; y: number; }' at tests/cases/conformance/internalModules/DeclarationMerging/test.ts 0:4, but here has type 'typeof Point'. var cl: { x: number; y: number; } var cl = A.Point(); @@ -45,7 +45,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error T var fn: () => { x: number; y: number }; var fn = B.Point; // not expected to be an error. bug 840000: [corelang] Function of fundule not assignalbe as expected ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' has type '() => { x: number; y: number; }' at tests/cases/conformance/internalModules/DeclarationMerging/test.ts 0:4, but here has type 'typeof Point'. var cl: { x: number; y: number; } var cl = B.Point(); diff --git a/tests/baselines/reference/asyncArrowFunction5_es2017.errors.txt b/tests/baselines/reference/asyncArrowFunction5_es2017.errors.txt index a2504b35e684f..594786d3005d4 100644 --- a/tests/baselines/reference/asyncArrowFunction5_es2017.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction5_es2017.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,11): error TS2304: Cannot find name 'async'. tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,18): error TS2304: Cannot find name 'await'. tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,24): error TS1005: ',' expected. -tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'. +tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'void'. tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,33): error TS1005: '=' expected. tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es2017.ts(1,40): error TS1109: Expression expected. @@ -15,7 +15,7 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction5_es20 ~ !!! error TS1005: ',' expected. ~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'void'. ~ !!! error TS1005: '=' expected. ~~ diff --git a/tests/baselines/reference/asyncArrowFunction5_es5.errors.txt b/tests/baselines/reference/asyncArrowFunction5_es5.errors.txt index a54794747faa7..949e2401d3513 100644 --- a/tests/baselines/reference/asyncArrowFunction5_es5.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction5_es5.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,11): error TS2304: Cannot find name 'async'. tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,18): error TS2304: Cannot find name 'await'. tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,24): error TS1005: ',' expected. -tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'. +tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'void'. tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,33): error TS1005: '=' expected. tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts(1,40): error TS1109: Expression expected. @@ -15,7 +15,7 @@ tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction5_es5.ts( ~ !!! error TS1005: ',' expected. ~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'void'. ~ !!! error TS1005: '=' expected. ~~ diff --git a/tests/baselines/reference/asyncArrowFunction5_es6.errors.txt b/tests/baselines/reference/asyncArrowFunction5_es6.errors.txt index aec8e36fae87a..b3cb60c95ca4a 100644 --- a/tests/baselines/reference/asyncArrowFunction5_es6.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction5_es6.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,11): error TS2304: Cannot find name 'async'. tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,18): error TS2304: Cannot find name 'await'. tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,24): error TS1005: ',' expected. -tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'. +tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,26): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'void'. tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,33): error TS1005: '=' expected. tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts(1,40): error TS1109: Expression expected. @@ -15,7 +15,7 @@ tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction5_es6.ts( ~ !!! error TS1005: ',' expected. ~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'void'. ~ !!! error TS1005: '=' expected. ~~ diff --git a/tests/baselines/reference/asyncArrowFunction9_es2017.errors.txt b/tests/baselines/reference/asyncArrowFunction9_es2017.errors.txt index ee94f3f9caf72..c888995f1fb2d 100644 --- a/tests/baselines/reference/asyncArrowFunction9_es2017.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction9_es2017.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,11): error TS2304: Cannot find name 'async'. tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,18): error TS2304: Cannot find name 'a'. tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,37): error TS1005: ',' expected. -tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'. +tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'void'. tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,46): error TS1005: '=' expected. tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es2017.ts(1,53): error TS1109: Expression expected. @@ -15,7 +15,7 @@ tests/cases/conformance/async/es2017/asyncArrowFunction/asyncArrowFunction9_es20 ~ !!! error TS1005: ',' expected. ~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'void'. ~ !!! error TS1005: '=' expected. ~~ diff --git a/tests/baselines/reference/asyncArrowFunction9_es5.errors.txt b/tests/baselines/reference/asyncArrowFunction9_es5.errors.txt index 30846e06d6a16..e215259245eb4 100644 --- a/tests/baselines/reference/asyncArrowFunction9_es5.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction9_es5.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,11): error TS2304: Cannot find name 'async'. tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,18): error TS2304: Cannot find name 'a'. tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,37): error TS1005: ',' expected. -tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'. +tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'void'. tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,46): error TS1005: '=' expected. tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts(1,53): error TS1109: Expression expected. @@ -15,7 +15,7 @@ tests/cases/conformance/async/es5/asyncArrowFunction/asyncArrowFunction9_es5.ts( ~ !!! error TS1005: ',' expected. ~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'void'. ~ !!! error TS1005: '=' expected. ~~ diff --git a/tests/baselines/reference/asyncArrowFunction9_es6.errors.txt b/tests/baselines/reference/asyncArrowFunction9_es6.errors.txt index 623095e8a5e33..8d974d75dd330 100644 --- a/tests/baselines/reference/asyncArrowFunction9_es6.errors.txt +++ b/tests/baselines/reference/asyncArrowFunction9_es6.errors.txt @@ -1,7 +1,7 @@ tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,11): error TS2304: Cannot find name 'async'. tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,18): error TS2304: Cannot find name 'a'. tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,37): error TS1005: ',' expected. -tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'. +tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,39): error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'void'. tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,46): error TS1005: '=' expected. tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts(1,53): error TS1109: Expression expected. @@ -15,7 +15,7 @@ tests/cases/conformance/async/es6/asyncArrowFunction/asyncArrowFunction9_es6.ts( ~ !!! error TS1005: ',' expected. ~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' must be of type 'PromiseConstructor', but here has type 'void'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Promise' has type 'PromiseConstructor' at lib.es2015.promise.d.ts 222:12, but here has type 'void'. ~ !!! error TS1005: '=' expected. ~~ diff --git a/tests/baselines/reference/augmentedTypesVar.errors.txt b/tests/baselines/reference/augmentedTypesVar.errors.txt index 24c194d25c34f..cbedb69bf4d1d 100644 --- a/tests/baselines/reference/augmentedTypesVar.errors.txt +++ b/tests/baselines/reference/augmentedTypesVar.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/augmentedTypesVar.ts(6,5): error TS2300: Duplicate identifier 'x2'. tests/cases/compiler/augmentedTypesVar.ts(7,10): error TS2300: Duplicate identifier 'x2'. -tests/cases/compiler/augmentedTypesVar.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'number', but here has type '() => void'. +tests/cases/compiler/augmentedTypesVar.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' has type 'number' at tests/cases/compiler/augmentedTypesVar.ts 8:4, but here has type '() => void'. tests/cases/compiler/augmentedTypesVar.ts(13,5): error TS2300: Duplicate identifier 'x4'. tests/cases/compiler/augmentedTypesVar.ts(14,7): error TS2300: Duplicate identifier 'x4'. tests/cases/compiler/augmentedTypesVar.ts(16,5): error TS2300: Duplicate identifier 'x4a'. @@ -29,7 +29,7 @@ tests/cases/compiler/augmentedTypesVar.ts(31,8): error TS2300: Duplicate identif var x3 = 1; var x3 = () => { } // error ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'number', but here has type '() => void'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' has type 'number' at tests/cases/compiler/augmentedTypesVar.ts 8:4, but here has type '() => void'. // var then class var x4 = 1; // error diff --git a/tests/baselines/reference/castingTuple.errors.txt b/tests/baselines/reference/castingTuple.errors.txt index 2f9eeedf9efd5..eb6aac5f46344 100644 --- a/tests/baselines/reference/castingTuple.errors.txt +++ b/tests/baselines/reference/castingTuple.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/tuple/castingTuple.ts(28,10): error TS2352: Type ' tests/cases/conformance/types/tuple/castingTuple.ts(29,10): error TS2352: Type '[C, D]' cannot be converted to type '[A, I]'. Type 'C' is not comparable to type 'A'. Property 'a' is missing in type 'C'. -tests/cases/conformance/types/tuple/castingTuple.ts(30,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. +tests/cases/conformance/types/tuple/castingTuple.ts(30,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' has type '{}[]' at tests/cases/conformance/types/tuple/castingTuple.ts 20:4, but here has type 'number[]'. tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot find name 't4'. @@ -46,7 +46,7 @@ tests/cases/conformance/types/tuple/castingTuple.ts(31,1): error TS2304: Cannot !!! error TS2352: Property 'a' is missing in type 'C'. var array1 = numStrTuple; ~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' must be of type '{}[]', but here has type 'number[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'array1' has type '{}[]' at tests/cases/conformance/types/tuple/castingTuple.ts 20:4, but here has type 'number[]'. t4[2] = 10; ~~ !!! error TS2304: Cannot find name 't4'. diff --git a/tests/baselines/reference/classWithDuplicateIdentifier.errors.txt b/tests/baselines/reference/classWithDuplicateIdentifier.errors.txt index 325db86d47d50..55e9714ee59b5 100644 --- a/tests/baselines/reference/classWithDuplicateIdentifier.errors.txt +++ b/tests/baselines/reference/classWithDuplicateIdentifier.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/classWithDuplicateIdentifier.ts(3,5): error TS2300: Duplica tests/cases/compiler/classWithDuplicateIdentifier.ts(6,5): error TS2300: Duplicate identifier 'b'. tests/cases/compiler/classWithDuplicateIdentifier.ts(7,5): error TS2300: Duplicate identifier 'b'. tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2300: Duplicate identifier 'c'. -tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'c' must be of type 'number', but here has type 'string'. +tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'c' has type 'number' at tests/cases/compiler/classWithDuplicateIdentifier.ts 9:4, but here has type 'string'. ==== tests/cases/compiler/classWithDuplicateIdentifier.ts (5 errors) ==== @@ -26,6 +26,6 @@ tests/cases/compiler/classWithDuplicateIdentifier.ts(11,5): error TS2403: Subseq ~ !!! error TS2300: Duplicate identifier 'c'. ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'c' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'c' has type 'number' at tests/cases/compiler/classWithDuplicateIdentifier.ts 9:4, but here has type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/declarationsAndAssignments.errors.txt b/tests/baselines/reference/declarationsAndAssignments.errors.txt index 64bd8d7e57825..8f6d44a7c3a10 100644 --- a/tests/baselines/reference/declarationsAndAssignments.errors.txt +++ b/tests/baselines/reference/declarationsAndAssignments.errors.txt @@ -5,7 +5,7 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(23,25): tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(24,19): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(28,28): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: any; }'. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(29,22): error TS2353: Object literal may only specify known properties, and 'x' does not exist in type '{ y: any; }'. -tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(58,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string | 1', but here has type 'string'. +tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(58,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string | 1' at tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts 55:16, but here has type 'string'. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,10): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,13): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(62,16): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. @@ -99,7 +99,7 @@ tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts(138,9): var x: number; var y: string; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string | 1', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string | 1' at tests/cases/conformance/es6/destructuring/declarationsAndAssignments.ts 55:16, but here has type 'string'. } function f8() { diff --git a/tests/baselines/reference/duplicateClassElements.errors.txt b/tests/baselines/reference/duplicateClassElements.errors.txt index 7579190db7194..f30b4a193f131 100644 --- a/tests/baselines/reference/duplicateClassElements.errors.txt +++ b/tests/baselines/reference/duplicateClassElements.errors.txt @@ -16,7 +16,7 @@ tests/cases/compiler/duplicateClassElements.ts(26,9): error TS2300: Duplicate id tests/cases/compiler/duplicateClassElements.ts(29,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(32,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2300: Duplicate identifier 'x2'. -tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2403: Subsequent variable declarations must have the same type. Variable 'x2' must be of type 'number', but here has type 'any'. +tests/cases/compiler/duplicateClassElements.ts(34,12): error TS2403: Subsequent variable declarations must have the same type. Variable 'x2' has type 'number' at tests/cases/compiler/duplicateClassElements.ts 28:8, but here has type 'any'. tests/cases/compiler/duplicateClassElements.ts(36,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/duplicateClassElements.ts(36,9): error TS2300: Duplicate identifier 'z2'. tests/cases/compiler/duplicateClassElements.ts(39,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -96,7 +96,7 @@ tests/cases/compiler/duplicateClassElements.ts(41,12): error TS2300: Duplicate i ~~ !!! error TS2300: Duplicate identifier 'x2'. ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x2' must be of type 'number', but here has type 'any'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x2' has type 'number' at tests/cases/compiler/duplicateClassElements.ts 28:8, but here has type 'any'. get z2() { ~~ diff --git a/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt b/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt index d8065df27c8a2..3602ca6e301bb 100644 --- a/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt +++ b/tests/baselines/reference/duplicateIdentifierInCatchBlock.errors.txt @@ -4,7 +4,7 @@ tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(6,10): error TS2300: Dup tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(8,9): error TS2300: Duplicate identifier 'w'. tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(12,9): error TS2300: Duplicate identifier 'x'. tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(13,14): error TS2300: Duplicate identifier 'x'. -tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(16,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'string', but here has type 'number'. +tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(16,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'string' at tests/cases/compiler/duplicateIdentifierInCatchBlock.ts 14:8, but here has type 'number'. ==== tests/cases/compiler/duplicateIdentifierInCatchBlock.ts (7 errors) ==== @@ -37,5 +37,5 @@ tests/cases/compiler/duplicateIdentifierInCatchBlock.ts(16,9): error TS2403: Sub var p: string; var p: number; // error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'string', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'string' at tests/cases/compiler/duplicateIdentifierInCatchBlock.ts 14:8, but here has type 'number'. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateLocalVariable1.errors.txt b/tests/baselines/reference/duplicateLocalVariable1.errors.txt index 0486cd1af6032..26e735e72ce99 100644 --- a/tests/baselines/reference/duplicateLocalVariable1.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable1.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(1,4): error TS1005: ';' expected. tests/cases/compiler/duplicateLocalVariable1.ts(1,11): error TS1146: Declaration expected. tests/cases/compiler/duplicateLocalVariable1.ts(1,13): error TS2304: Cannot find name 'commonjs'. -tests/cases/compiler/duplicateLocalVariable1.ts(186,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. +tests/cases/compiler/duplicateLocalVariable1.ts(186,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type 'string' at tests/cases/compiler/duplicateLocalVariable1.ts 180:21, but here has type 'number'. tests/cases/compiler/duplicateLocalVariable1.ts(186,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. tests/cases/compiler/duplicateLocalVariable1.ts(186,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. @@ -200,7 +200,7 @@ tests/cases/compiler/duplicateLocalVariable1.ts(186,37): error TS2356: An arithm var bytes = []; for (var i = 0; i < 14; i++) { ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type 'string' at tests/cases/compiler/duplicateLocalVariable1.ts 180:21, but here has type 'number'. ~~~~~~ !!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. ~ diff --git a/tests/baselines/reference/duplicateLocalVariable2.errors.txt b/tests/baselines/reference/duplicateLocalVariable2.errors.txt index 5e89cc422cce9..13b2301d08514 100644 --- a/tests/baselines/reference/duplicateLocalVariable2.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/duplicateLocalVariable2.ts(27,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. +tests/cases/compiler/duplicateLocalVariable2.ts(27,22): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type 'string' at tests/cases/compiler/duplicateLocalVariable2.ts 21:21, but here has type 'number'. tests/cases/compiler/duplicateLocalVariable2.ts(27,29): error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type. @@ -32,7 +32,7 @@ tests/cases/compiler/duplicateLocalVariable2.ts(27,37): error TS2356: An arithme var bytes = []; for (var i = 0; i < 14; i++) { ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'string', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type 'string' at tests/cases/compiler/duplicateLocalVariable2.ts 21:21, but here has type 'number'. ~~~~~~ !!! error TS2365: Operator '<' cannot be applied to types 'string' and 'number'. ~ diff --git a/tests/baselines/reference/duplicateLocalVariable3.errors.txt b/tests/baselines/reference/duplicateLocalVariable3.errors.txt index 5dda5872da00f..bff7ef43070f4 100644 --- a/tests/baselines/reference/duplicateLocalVariable3.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable3.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/duplicateLocalVariable3.ts(11,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'string'. +tests/cases/compiler/duplicateLocalVariable3.ts(11,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' has type 'number' at tests/cases/compiler/duplicateLocalVariable3.ts 9:8, but here has type 'string'. ==== tests/cases/compiler/duplicateLocalVariable3.ts (1 errors) ==== @@ -14,5 +14,5 @@ tests/cases/compiler/duplicateLocalVariable3.ts(11,9): error TS2403: Subsequent var z = 3; var z = ""; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' has type 'number' at tests/cases/compiler/duplicateLocalVariable3.ts 9:8, but here has type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/duplicateLocalVariable4.errors.txt b/tests/baselines/reference/duplicateLocalVariable4.errors.txt index 3209c23e39efb..b4b838c3afa2d 100644 --- a/tests/baselines/reference/duplicateLocalVariable4.errors.txt +++ b/tests/baselines/reference/duplicateLocalVariable4.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/duplicateLocalVariable4.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type 'E'. +tests/cases/compiler/duplicateLocalVariable4.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'typeof E' at tests/cases/compiler/duplicateLocalVariable4.ts 4:4, but here has type 'E'. ==== tests/cases/compiler/duplicateLocalVariable4.ts (1 errors) ==== @@ -9,4 +9,4 @@ tests/cases/compiler/duplicateLocalVariable4.ts(6,5): error TS2403: Subsequent v var x = E; var x = E.a; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type 'E'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'typeof E' at tests/cases/compiler/duplicateLocalVariable4.ts 4:4, but here has type 'E'. \ No newline at end of file diff --git a/tests/baselines/reference/duplicateVariablesWithAny.errors.txt b/tests/baselines/reference/duplicateVariablesWithAny.errors.txt index 787e118ca373c..6959eb85a327c 100644 --- a/tests/baselines/reference/duplicateVariablesWithAny.errors.txt +++ b/tests/baselines/reference/duplicateVariablesWithAny.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/duplicateVariablesWithAny.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. -tests/cases/compiler/duplicateVariablesWithAny.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. -tests/cases/compiler/duplicateVariablesWithAny.ts(10,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. -tests/cases/compiler/duplicateVariablesWithAny.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. +tests/cases/compiler/duplicateVariablesWithAny.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/compiler/duplicateVariablesWithAny.ts 1:4, but here has type 'number'. +tests/cases/compiler/duplicateVariablesWithAny.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string' at tests/cases/compiler/duplicateVariablesWithAny.ts 4:4, but here has type 'any'. +tests/cases/compiler/duplicateVariablesWithAny.ts(10,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/compiler/duplicateVariablesWithAny.ts 8:8, but here has type 'number'. +tests/cases/compiler/duplicateVariablesWithAny.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string' at tests/cases/compiler/duplicateVariablesWithAny.ts 11:8, but here has type 'any'. ==== tests/cases/compiler/duplicateVariablesWithAny.ts (4 errors) ==== @@ -9,23 +9,23 @@ tests/cases/compiler/duplicateVariablesWithAny.ts(13,9): error TS2403: Subsequen var x: any; var x = 2; //error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/compiler/duplicateVariablesWithAny.ts 1:4, but here has type 'number'. var y = ""; var y; //error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string' at tests/cases/compiler/duplicateVariablesWithAny.ts 4:4, but here has type 'any'. module N { var x: any; var x = 2; //error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/compiler/duplicateVariablesWithAny.ts 8:8, but here has type 'number'. var y = ""; var y; //error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'any'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string' at tests/cases/compiler/duplicateVariablesWithAny.ts 11:8, but here has type 'any'. } var z: any; diff --git a/tests/baselines/reference/duplicateVarsAcrossFileBoundaries.errors.txt b/tests/baselines/reference/duplicateVarsAcrossFileBoundaries.errors.txt index d422248321284..3312b2127b35a 100644 --- a/tests/baselines/reference/duplicateVarsAcrossFileBoundaries.errors.txt +++ b/tests/baselines/reference/duplicateVarsAcrossFileBoundaries.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'boolean'. -tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'string'. -tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'number'. -tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'boolean'. +tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'number' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts 0:4, but here has type 'boolean'. +tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'number' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts 0:4, but here has type 'string'. +tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts 1:4, but here has type 'number'. +tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(3,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' has type 'number' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts 1:4, but here has type 'boolean'. ==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts (0 errors) ==== @@ -11,19 +11,19 @@ tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts(3,5): error TS2403: ==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts (1 errors) ==== var x = true; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'boolean'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'number' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts 0:4, but here has type 'boolean'. var z = 3; ==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_2.ts (3 errors) ==== var x = ""; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'number' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts 0:4, but here has type 'string'. var y = 3; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'string', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'string' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_0.ts 1:4, but here has type 'number'. var z = false; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'number', but here has type 'boolean'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'z' has type 'number' at tests/cases/compiler/duplicateVarsAcrossFileBoundaries_1.ts 1:4, but here has type 'boolean'. ==== tests/cases/compiler/duplicateVarsAcrossFileBoundaries_3.ts (0 errors) ==== var x = 0; diff --git a/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt b/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt index e7c1297e1fd41..3fd0fcaf7aceb 100644 --- a/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt +++ b/tests/baselines/reference/enumAssignabilityInInheritance.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts(104,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. -tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts(109,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts(104,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'E' at tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts 21:4, but here has type 'Object'. +tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts(109,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'E' at tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts 21:4, but here has type 'Object'. ==== tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts (2 errors) ==== @@ -108,11 +108,11 @@ tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssi var r4 = foo16(E.A); ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'E' at tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts 21:4, but here has type 'Object'. declare function foo17(x: {}): {}; declare function foo17(x: E): E; var r4 = foo16(E.A); ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'E', but here has type 'Object'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'E' at tests/cases/conformance/types/typeRelationships/assignmentCompatibility/enumAssignabilityInInheritance.ts 21:4, but here has type 'Object'. \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatements.errors.txt b/tests/baselines/reference/for-inStatements.errors.txt index c5ca29d21500b..60a921a7af5a2 100644 --- a/tests/baselines/reference/for-inStatements.errors.txt +++ b/tests/baselines/reference/for-inStatements.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(33,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. -tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(50,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. +tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(33,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatements.ts 30:17, but here has type 'keyof this'. +tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(50,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatements.ts 47:17, but here has type 'keyof this'. tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(79,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. @@ -38,7 +38,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(79,15): for (var x in this.biz) { } for (var x in this) { } ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatements.ts 30:17, but here has type 'keyof this'. return null; } @@ -57,7 +57,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatements.ts(79,15): for (var x in this.biz) { } for (var x in this) { } ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatements.ts 47:17, but here has type 'keyof this'. for (var x in super.biz) { } for (var x in super.biz()) { } diff --git a/tests/baselines/reference/for-inStatementsArrayErrors.errors.txt b/tests/baselines/reference/for-inStatementsArrayErrors.errors.txt index a47ea077d95d8..0625460f6f462 100644 --- a/tests/baselines/reference/for-inStatementsArrayErrors.errors.txt +++ b/tests/baselines/reference/for-inStatementsArrayErrors.errors.txt @@ -2,8 +2,8 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors. tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(5,16): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(6,9): error TS2365: Operator '===' cannot be applied to types 'string' and 'number'. tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(8,16): error TS2339: Property 'unknownProperty' does not exist on type 'string'. -tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(12,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'number', but here has type 'string'. -tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(16,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type 'any', but here has type 'string'. +tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(12,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type 'number' at tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts 10:4, but here has type 'string'. +tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts(16,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' has type 'any' at tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts 14:4, but here has type 'string'. ==== tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts (6 errors) ==== @@ -28,12 +28,12 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors. var i: number; for (var i in a ) { ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type 'number' at tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts 10:4, but here has type 'string'. } var j: any; for (var j in a ) { ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type 'any', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' has type 'any' at tests/cases/conformance/statements/for-inStatements/for-inStatementsArrayErrors.ts 14:4, but here has type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/for-inStatementsInvalid.errors.txt b/tests/baselines/reference/for-inStatementsInvalid.errors.txt index f98349973a368..87d4f5582da5d 100644 --- a/tests/baselines/reference/for-inStatementsInvalid.errors.txt +++ b/tests/baselines/reference/for-inStatementsInvalid.errors.txt @@ -9,10 +9,10 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(1 tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(20,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(22,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(29,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. -tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(31,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(31,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts 28:17, but here has type 'keyof this'. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(38,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(46,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. -tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(48,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. +tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(48,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts 45:17, but here has type 'keyof this'. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(51,23): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(62,15): error TS2407: The right-hand side of a 'for...in' statement must be of type 'any', an object type or a type parameter. @@ -72,7 +72,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(6 for (var x in this.biz) { } for (var x in this) { } ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts 28:17, but here has type 'keyof this'. return null; } @@ -95,7 +95,7 @@ tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts(6 for (var x in this.biz) { } for (var x in this) { } ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'keyof this'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/statements/for-inStatements/for-inStatementsInvalid.ts 45:17, but here has type 'keyof this'. for (var x in super.biz) { } for (var x in super.biz()) { } diff --git a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt index 53ecb88363df4..e1175477f5d3d 100644 --- a/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt +++ b/tests/baselines/reference/forStatementsMultipleInvalidDecl.errors.txt @@ -1,15 +1,15 @@ -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(32,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(33,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(34,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(35,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(36,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(39,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(40,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(43,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(46,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(50,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. -tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(53,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(32,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'number'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(33,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'string'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(34,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'C'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(35,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'D'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(36,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'typeof M'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(39,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 37:9, but here has type 'C'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(40,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 37:9, but here has type 'C2'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(43,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' has type '(x: string) => number' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 41:8, but here has type '(x: number) => string'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(46,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 44:8, but here has type 'number[]'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(47,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 44:8, but here has type '(C | D)[]'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(50,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' has type 'D[]' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 48:8, but here has type 'D[]'. +tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts(53,10): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' has type 'typeof M' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 51:8, but here has type 'typeof A'. ==== tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts (12 errors) ==== @@ -46,47 +46,47 @@ tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDec for( var a: any;;){} for( var a = 1;;){} ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'number'. for( var a = 'a string';;){} ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'string'. for( var a = new C();;){} ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'C'. for( var a = new D();;){} ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'D'. for( var a = M;;){} ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 30:9, but here has type 'typeof M'. for( var b: I;;){} for( var b = new C();;){} ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 37:9, but here has type 'C'. for( var b = new C2();;){} ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 37:9, but here has type 'C2'. for(var f = F;;){} for( var f = (x: number) => '';;){} ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' has type '(x: string) => number' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 41:8, but here has type '(x: number) => string'. for(var arr: string[];;){} for( var arr = [1, 2, 3, 4];;){} ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 44:8, but here has type 'number[]'. for( var arr = [new C(), new C2(), new D()];;){} ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 44:8, but here has type '(C | D)[]'. for(var arr2 = [new D()];;){} for( var arr2 = new Array>();;){} ~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' has type 'D[]' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 48:8, but here has type 'D[]'. for(var m: typeof M;;){} for( var m = M.A;;){} ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' has type 'typeof M' at tests/cases/conformance/statements/forStatements/forStatementsMultipleInvalidDecl.ts 51:8, but here has type 'typeof A'. \ No newline at end of file diff --git a/tests/baselines/reference/functionArgShadowing.errors.txt b/tests/baselines/reference/functionArgShadowing.errors.txt index 930221784526e..e85a5255e43df 100644 --- a/tests/baselines/reference/functionArgShadowing.errors.txt +++ b/tests/baselines/reference/functionArgShadowing.errors.txt @@ -1,6 +1,6 @@ -tests/cases/compiler/functionArgShadowing.ts(4,8): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'A', but here has type 'B'. +tests/cases/compiler/functionArgShadowing.ts(4,8): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'A' at tests/cases/compiler/functionArgShadowing.ts 2:13, but here has type 'B'. tests/cases/compiler/functionArgShadowing.ts(5,8): error TS2339: Property 'bar' does not exist on type 'A'. -tests/cases/compiler/functionArgShadowing.ts(10,7): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'number', but here has type 'string'. +tests/cases/compiler/functionArgShadowing.ts(10,7): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'number' at tests/cases/compiler/functionArgShadowing.ts 8:20, but here has type 'string'. ==== tests/cases/compiler/functionArgShadowing.ts (3 errors) ==== @@ -9,7 +9,7 @@ tests/cases/compiler/functionArgShadowing.ts(10,7): error TS2403: Subsequent var function foo(x: A) { var x: B = new B(); ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'A', but here has type 'B'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'A' at tests/cases/compiler/functionArgShadowing.ts 2:13, but here has type 'B'. x.bar(); // the property bar does not exist on a value of type A ~~~ !!! error TS2339: Property 'bar' does not exist on type 'A'. @@ -19,7 +19,7 @@ tests/cases/compiler/functionArgShadowing.ts(10,7): error TS2403: Subsequent var constructor(public p: number) { var p: string; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'number' at tests/cases/compiler/functionArgShadowing.ts 8:20, but here has type 'string'. var n: number = p; } diff --git a/tests/baselines/reference/gettersAndSettersErrors.errors.txt b/tests/baselines/reference/gettersAndSettersErrors.errors.txt index a3be786cb264b..3d762c6270f99 100644 --- a/tests/baselines/reference/gettersAndSettersErrors.errors.txt +++ b/tests/baselines/reference/gettersAndSettersErrors.errors.txt @@ -1,7 +1,7 @@ tests/cases/compiler/gettersAndSettersErrors.ts(2,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(3,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2300: Duplicate identifier 'Foo'. -tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2403: Subsequent variable declarations must have the same type. Variable 'Foo' must be of type 'string', but here has type 'number'. +tests/cases/compiler/gettersAndSettersErrors.ts(5,12): error TS2403: Subsequent variable declarations must have the same type. Variable 'Foo' has type 'string' at tests/cases/compiler/gettersAndSettersErrors.ts 1:15, but here has type 'number'. tests/cases/compiler/gettersAndSettersErrors.ts(6,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(7,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/compiler/gettersAndSettersErrors.ts(11,17): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -23,7 +23,7 @@ tests/cases/compiler/gettersAndSettersErrors.ts(12,16): error TS2379: Getter and ~~~ !!! error TS2300: Duplicate identifier 'Foo'. ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Foo' must be of type 'string', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'Foo' has type 'string' at tests/cases/compiler/gettersAndSettersErrors.ts 1:15, but here has type 'number'. public get Goo(v:string):string {return null;} // error - getters must not have a parameter ~~~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. diff --git a/tests/baselines/reference/identityForSignaturesWithTypeParametersAndAny.errors.txt b/tests/baselines/reference/identityForSignaturesWithTypeParametersAndAny.errors.txt index 6023928022699..bce8f57b442b6 100644 --- a/tests/baselines/reference/identityForSignaturesWithTypeParametersAndAny.errors.txt +++ b/tests/baselines/reference/identityForSignaturesWithTypeParametersAndAny.errors.txt @@ -1,7 +1,7 @@ -tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'g' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => any'. -tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'h' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => any'. -tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: string) => any'. -tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(14,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => string'. +tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'g' has type '(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 3:4, but here has type '(x: any, y: any) => any'. +tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'h' has type '(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 6:4, but here has type '(x: any, y: any) => any'. +tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type '(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 9:4, but here has type '(x: any, y: string) => any'. +tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(14,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'j' has type '(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 12:4, but here has type '(x: any, y: any) => string'. ==== tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts (4 errors) ==== @@ -11,19 +11,19 @@ tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts(14,5): err var g: (x: T, y: U) => T; var g: (x: any, y: any) => any; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'g' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => any'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'g' has type '(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 3:4, but here has type '(x: any, y: any) => any'. var h: (x: T, y: U) => T; var h: (x: any, y: any) => any; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'h' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => any'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'h' has type '(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 6:4, but here has type '(x: any, y: any) => any'. var i: (x: T, y: U) => T; var i: (x: any, y: string) => any; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: string) => any'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'i' has type '(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 9:4, but here has type '(x: any, y: string) => any'. var j: (x: T, y: U) => T; var j: (x: any, y: any) => string; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' must be of type '(x: T, y: U) => T', but here has type '(x: any, y: any) => string'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'j' has type '(x: T, y: U) => T' at tests/cases/compiler/identityForSignaturesWithTypeParametersAndAny.ts 12:4, but here has type '(x: any, y: any) => string'. \ No newline at end of file diff --git a/tests/baselines/reference/interfaceDeclaration1.errors.txt b/tests/baselines/reference/interfaceDeclaration1.errors.txt index 95b3d90ca2cbb..7a31aec7c6a3f 100644 --- a/tests/baselines/reference/interfaceDeclaration1.errors.txt +++ b/tests/baselines/reference/interfaceDeclaration1.errors.txt @@ -2,7 +2,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(2,5): error TS2300: Duplicate iden tests/cases/compiler/interfaceDeclaration1.ts(3,5): error TS2300: Duplicate identifier 'item'. tests/cases/compiler/interfaceDeclaration1.ts(7,5): error TS2300: Duplicate identifier 'item'. tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2300: Duplicate identifier 'item'. -tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'item' must be of type 'any', but here has type 'number'. +tests/cases/compiler/interfaceDeclaration1.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'item' has type 'any' at tests/cases/compiler/interfaceDeclaration1.ts 6:4, but here has type 'number'. tests/cases/compiler/interfaceDeclaration1.ts(22,11): error TS2310: Type 'I5' recursively references itself as a base type. tests/cases/compiler/interfaceDeclaration1.ts(35,7): error TS2420: Class 'C1' incorrectly implements interface 'I3'. Property 'prototype' is missing in type 'C1'. @@ -29,7 +29,7 @@ tests/cases/compiler/interfaceDeclaration1.ts(52,11): error TS2320: Interface 'i ~~~~ !!! error TS2300: Duplicate identifier 'item'. ~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'item' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'item' has type 'any' at tests/cases/compiler/interfaceDeclaration1.ts 6:4, but here has type 'number'. } interface I3 { diff --git a/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt b/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt index 3ec718f3b25fe..79c958e0ca677 100644 --- a/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt +++ b/tests/baselines/reference/invalidMultipleVariableDeclarations.errors.txt @@ -1,15 +1,15 @@ -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(32,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(33,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(34,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(35,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(36,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(39,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(43,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(46,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(50,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. -tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(53,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(32,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'number'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(33,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'string'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(34,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'C'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(35,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'D'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(36,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'typeof M'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(39,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 37:4, but here has type 'C'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(40,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 37:4, but here has type 'C2'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(43,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'f' has type '(x: string) => number' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 41:4, but here has type '(x: number) => string'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(46,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 44:4, but here has type 'number[]'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(47,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 44:4, but here has type '(C | D)[]'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(50,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' has type 'D[]' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 48:4, but here has type 'D[]'. +tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts(53,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'm' has type 'typeof M' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 51:4, but here has type 'typeof A'. ==== tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts (12 errors) ==== @@ -46,47 +46,47 @@ tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDec var a: any; var a = 1; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'number'. var a = 'a string'; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'string'. var a = new C(); ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'C'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'C'. var a = new D(); ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'D'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'D'. var a = M; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' must be of type 'any', but here has type 'typeof M'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'a' has type 'any' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 30:4, but here has type 'typeof M'. var b: I; var b = new C(); ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 37:4, but here has type 'C'. var b = new C2(); ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' must be of type 'I', but here has type 'C2'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'b' has type 'I' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 37:4, but here has type 'C2'. var f = F; var f = (x: number) => ''; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' must be of type '(x: string) => number', but here has type '(x: number) => string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'f' has type '(x: string) => number' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 41:4, but here has type '(x: number) => string'. var arr: string[]; var arr = [1, 2, 3, 4]; ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type 'number[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 44:4, but here has type 'number[]'. var arr = [new C(), new C2(), new D()]; ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' must be of type 'string[]', but here has type '(C | D)[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr' has type 'string[]' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 44:4, but here has type '(C | D)[]'. var arr2 = [new D()]; var arr2 = new Array>(); ~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' must be of type 'D[]', but here has type 'D[]'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'arr2' has type 'D[]' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 48:4, but here has type 'D[]'. var m: typeof M; var m = M.A; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' must be of type 'typeof M', but here has type 'typeof A'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'm' has type 'typeof M' at tests/cases/conformance/statements/VariableStatements/invalidMultipleVariableDeclarations.ts 51:4, but here has type 'typeof A'. \ No newline at end of file diff --git a/tests/baselines/reference/jsFileCompilationDuplicateVariableErrorReported.errors.txt b/tests/baselines/reference/jsFileCompilationDuplicateVariableErrorReported.errors.txt index f1374d957673f..02e32a647f4c4 100644 --- a/tests/baselines/reference/jsFileCompilationDuplicateVariableErrorReported.errors.txt +++ b/tests/baselines/reference/jsFileCompilationDuplicateVariableErrorReported.errors.txt @@ -1,5 +1,5 @@ error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. -tests/cases/compiler/a.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'. +tests/cases/compiler/a.ts(1,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/compiler/b.js 0:4, but here has type 'number'. !!! error TS5053: Option 'allowJs' cannot be specified with option 'declaration'. @@ -9,4 +9,4 @@ tests/cases/compiler/a.ts(1,5): error TS2403: Subsequent variable declarations m ==== tests/cases/compiler/a.ts (1 errors) ==== var x = 10; // Error reported so no declaration file generated? ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/compiler/b.js 0:4, but here has type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/mappedTypeErrors.errors.txt b/tests/baselines/reference/mappedTypeErrors.errors.txt index 3245f9932f009..396adaadf342c 100644 --- a/tests/baselines/reference/mappedTypeErrors.errors.txt +++ b/tests/baselines/reference/mappedTypeErrors.errors.txt @@ -16,10 +16,10 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(37,24): error TS2344: T Type 'T' is not assignable to type '"visible"'. Type 'string | number' is not assignable to type '"visible"'. Type 'string' is not assignable to type '"visible"'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(59,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P] | undefined; }'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(60,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]: T[P]; }'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(61,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'. -tests/cases/conformance/types/mapped/mappedTypeErrors.ts(66,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]: T[P][]; }'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(59,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 57:8, but here has type '{ [P in keyof T]?: T[P] | undefined; }'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(60,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 57:8, but here has type '{ readonly [P in keyof T]: T[P]; }'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(61,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 57:8, but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'. +tests/cases/conformance/types/mapped/mappedTypeErrors.ts(66,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 64:8, but here has type '{ [P in keyof T]: T[P][]; }'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(75,45): error TS2345: Argument of type '{ x: number; }' is not assignable to parameter of type 'Readonly<{ x: number; y: number; }>'. Property 'y' is missing in type '{ x: number; }'. tests/cases/conformance/types/mapped/mappedTypeErrors.ts(77,59): error TS2345: Argument of type '{ x: number; y: number; z: number; }' is not assignable to parameter of type 'Readonly<{ x: number; y: number; }>'. @@ -138,20 +138,20 @@ tests/cases/conformance/types/mapped/mappedTypeErrors.ts(136,21): error TS2536: var x: { [P in keyof T]: T[P] }; var x: { [P in keyof T]?: T[P] }; // Error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]?: T[P] | undefined; }'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 57:8, but here has type '{ [P in keyof T]?: T[P] | undefined; }'. var x: { readonly [P in keyof T]: T[P] }; // Error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]: T[P]; }'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 57:8, but here has type '{ readonly [P in keyof T]: T[P]; }'. var x: { readonly [P in keyof T]?: T[P] }; // Error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 57:8, but here has type '{ readonly [P in keyof T]?: T[P] | undefined; }'. } function f12() { var x: { [P in keyof T]: T[P] }; var x: { [P in keyof T]: T[P][] }; // Error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type '{ [P in keyof T]: T[P]; }', but here has type '{ [P in keyof T]: T[P][]; }'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type '{ [P in keyof T]: T[P]; }' at tests/cases/conformance/types/mapped/mappedTypeErrors.ts 64:8, but here has type '{ [P in keyof T]: T[P][]; }'. } // Check that inferences to mapped types are secondary diff --git a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt index 437bf2d80f0c7..c4a6cb926d6d1 100644 --- a/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt +++ b/tests/baselines/reference/mergedInterfacesWithConflictingPropertyNames.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(15,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'T', but here has type 'number'. -tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(39,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'T', but here has type 'number'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 1:4, but here has type 'number'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(15,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 10:8, but here has type 'number'. +tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts(39,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 32:8, but here has type 'number'. ==== tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts (3 errors) ==== @@ -11,7 +11,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli interface A { x: number; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'string', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'string' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 1:4, but here has type 'number'. } module M { @@ -22,7 +22,7 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli interface A { x: number; // error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'T', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 10:8, but here has type 'number'. } } @@ -48,6 +48,6 @@ tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConfli export interface A { x: number; // error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'T', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'T' at tests/cases/conformance/interfaces/declarationMerging/mergedInterfacesWithConflictingPropertyNames.ts 32:8, but here has type 'number'. } } \ No newline at end of file diff --git a/tests/baselines/reference/missingAndExcessProperties.errors.txt b/tests/baselines/reference/missingAndExcessProperties.errors.txt index 0ee69d9af306c..c9b0fb8257f22 100644 --- a/tests/baselines/reference/missingAndExcessProperties.errors.txt +++ b/tests/baselines/reference/missingAndExcessProperties.errors.txt @@ -1,11 +1,11 @@ tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(3,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(3,14): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. -tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(4,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(4,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:10, but here has type 'number'. tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(4,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(5,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. -tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(5,14): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'. -tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(6,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. -tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(6,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(5,14): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:13, but here has type 'number'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(6,11): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:10, but here has type 'number'. +tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(6,18): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:13, but here has type 'number'. tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(12,8): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(12,11): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(13,18): error TS2525: Initializer provides no value for this binding element and the binding element has no default value. @@ -30,19 +30,19 @@ tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts(31,16): !!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. var { x = 1, y } = {}; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:10, but here has type 'number'. ~ !!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. var { x, y = 1 } = {}; ~ !!! error TS2525: Initializer provides no value for this binding element and the binding element has no default value. ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:13, but here has type 'number'. var { x = 1, y = 1 } = {}; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:10, but here has type 'number'. ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'any' at tests/cases/conformance/es6/destructuring/missingAndExcessProperties.ts 2:13, but here has type 'number'. } // Missing properties diff --git a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt index 102a6a0783673..172576cdde1da 100644 --- a/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt +++ b/tests/baselines/reference/numericStringNamedPropertyEquivalence.errors.txt @@ -3,7 +3,7 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericString tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(12,5): error TS2300: Duplicate identifier '1'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(16,5): error TS2300: Duplicate identifier '1'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2300: Duplicate identifier '1'. -tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2403: Subsequent variable declarations must have the same type. Variable '1.0' must be of type 'number', but here has type 'string'. +tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2403: Subsequent variable declarations must have the same type. Variable '1.0' has type 'number' at tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts 15:4, but here has type 'string'. tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(22,5): error TS2300: Duplicate identifier '0'. @@ -36,7 +36,7 @@ tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericString ~~~ !!! error TS2300: Duplicate identifier '1'. ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable '1.0' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable '1.0' has type 'number' at tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts 15:4, but here has type 'string'. } var b = { diff --git a/tests/baselines/reference/optionalParamterAndVariableDeclaration2.errors.txt b/tests/baselines/reference/optionalParamterAndVariableDeclaration2.errors.txt index 982318d2f2548..57dba5ca474a6 100644 --- a/tests/baselines/reference/optionalParamterAndVariableDeclaration2.errors.txt +++ b/tests/baselines/reference/optionalParamterAndVariableDeclaration2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts(3,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'options' must be of type 'number | undefined', but here has type 'number'. +tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts(3,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'options' has type 'number | undefined' at tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts 1:16, but here has type 'number'. ==== tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts (1 errors) ==== @@ -6,7 +6,7 @@ tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts(3,13): error TS2 constructor(options?: number) { var options = (options || 0); ~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'options' must be of type 'number | undefined', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'options' has type 'number | undefined' at tests/cases/compiler/optionalParamterAndVariableDeclaration2.ts 1:16, but here has type 'number'. } } \ No newline at end of file diff --git a/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt b/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt index f108f0ea92da0..dddc0a0d575b6 100644 --- a/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt +++ b/tests/baselines/reference/orderMattersForSignatureGroupIdentity.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(19,5): error TS2345: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. -tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'w' must be of type 'A', but here has type 'C'. +tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'w' has type 'A' at tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts 20:4, but here has type 'C'. tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(24,5): error TS2345: Argument of type '{ s: string; n: number; }' is not assignable to parameter of type '{ n: number; }'. Object literal may only specify known properties, and 's' does not exist in type '{ n: number; }'. @@ -32,7 +32,7 @@ tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts(24,5): error TS234 var w: A; var w: C; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'w' must be of type 'A', but here has type 'C'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'w' has type 'A' at tests/cases/compiler/orderMattersForSignatureGroupIdentity.ts 20:4, but here has type 'C'. w({ s: "", n: 0 }).toLowerCase(); ~~~~~ diff --git a/tests/baselines/reference/overloadResolution.errors.txt b/tests/baselines/reference/overloadResolution.errors.txt index 37cea935e66e4..d3ad02929f20d 100644 --- a/tests/baselines/reference/overloadResolution.errors.txt +++ b/tests/baselines/reference/overloadResolution.errors.txt @@ -6,7 +6,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(71,21): tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(81,5): error TS2344: Type 'boolean' does not satisfy the constraint 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(84,5): error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(85,11): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' has type 'number' at tests/cases/conformance/expressions/functionCalls/overloadResolution.ts 53:4, but here has type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): error TS2339: Property 'toFixed' does not exist on type 'string'. @@ -119,7 +119,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolution.ts(91,22): function fn5() { return undefined; } var n = fn5((n) => n.toFixed()); ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' has type 'number' at tests/cases/conformance/expressions/functionCalls/overloadResolution.ts 53:4, but here has type 'string'. ~~~~~~~ !!! error TS2339: Property 'toFixed' does not exist on type 'string'. var s = fn5((n) => n.substr(0)); diff --git a/tests/baselines/reference/overloadResolutionConstructors.errors.txt b/tests/baselines/reference/overloadResolutionConstructors.errors.txt index 9b09992228e0c..474ee2c60d73c 100644 --- a/tests/baselines/reference/overloadResolutionConstructors.errors.txt +++ b/tests/baselines/reference/overloadResolutionConstructors.errors.txt @@ -6,7 +6,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(88,9): error TS2344: Type 'boolean' does not satisfy the constraint 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(91,9): error TS2345: Argument of type 'true' is not assignable to parameter of type 'number'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(92,15): error TS2345: Argument of type 'true' is not assignable to parameter of type 'string'. -tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(100,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. +tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(100,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'n' has type 'number' at tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts 57:4, but here has type 'string'. tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts(100,26): error TS2339: Property 'toFixed' does not exist on type 'string'. @@ -128,7 +128,7 @@ tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors var fn5: fn5; var n = new fn5((n) => n.toFixed()); ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'n' has type 'number' at tests/cases/conformance/expressions/functionCalls/overloadResolutionConstructors.ts 57:4, but here has type 'string'. ~~~~~~~ !!! error TS2339: Property 'toFixed' does not exist on type 'string'. var s = new fn5((n) => n.substr(0)); diff --git a/tests/baselines/reference/parserCastVersusArrowFunction1.errors.txt b/tests/baselines/reference/parserCastVersusArrowFunction1.errors.txt index e2d90538b8c49..8194219f55516 100644 --- a/tests/baselines/reference/parserCastVersusArrowFunction1.errors.txt +++ b/tests/baselines/reference/parserCastVersusArrowFunction1.errors.txt @@ -1,8 +1,8 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(2,10): error TS2304: Cannot find name 'T'. tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(2,12): error TS2304: Cannot find name 'a'. -tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(4,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '() => number', but here has type '(a: any) => number'. -tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '() => number', but here has type '(a: any, b: any) => number'. -tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '() => number', but here has type '(a?: number, b?: number) => number'. +tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(4,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' has type '() => number' at tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts 0:4, but here has type '(a: any) => number'. +tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' has type '() => number' at tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts 0:4, but here has type '(a: any, b: any) => number'. +tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'v' has type '() => number' at tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts 0:4, but here has type '(a?: number, b?: number) => number'. tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(8,10): error TS2304: Cannot find name 'T'. tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(8,13): error TS2304: Cannot find name 'a'. tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts(9,10): error TS2304: Cannot find name 'T'. @@ -24,13 +24,13 @@ tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunctio var v = (a) => 1; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '() => number', but here has type '(a: any) => number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' has type '() => number' at tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts 0:4, but here has type '(a: any) => number'. var v = (a, b) => 1; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '() => number', but here has type '(a: any, b: any) => number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' has type '() => number' at tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts 0:4, but here has type '(a: any, b: any) => number'. var v = (a = 1, b = 2) => 1; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' must be of type '() => number', but here has type '(a?: number, b?: number) => number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'v' has type '() => number' at tests/cases/conformance/parser/ecmascript5/Generics/parserCastVersusArrowFunction1.ts 0:4, but here has type '(a?: number, b?: number) => number'. var v = (a); ~ diff --git a/tests/baselines/reference/promiseIdentity2.errors.txt b/tests/baselines/reference/promiseIdentity2.errors.txt index edfba2f42bcd4..38f426e434155 100644 --- a/tests/baselines/reference/promiseIdentity2.errors.txt +++ b/tests/baselines/reference/promiseIdentity2.errors.txt @@ -1,4 +1,4 @@ -tests/cases/compiler/promiseIdentity2.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise', but here has type 'Promise'. +tests/cases/compiler/promiseIdentity2.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'IPromise' at tests/cases/compiler/promiseIdentity2.ts 9:4, but here has type 'Promise'. ==== tests/cases/compiler/promiseIdentity2.ts (1 errors) ==== @@ -14,4 +14,4 @@ tests/cases/compiler/promiseIdentity2.ts(11,5): error TS2403: Subsequent variabl var x: IPromise; var x: Promise; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise', but here has type 'Promise'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'IPromise' at tests/cases/compiler/promiseIdentity2.ts 9:4, but here has type 'Promise'. \ No newline at end of file diff --git a/tests/baselines/reference/promiseIdentityWithAny2.errors.txt b/tests/baselines/reference/promiseIdentityWithAny2.errors.txt index 9d01438b88c49..69c09a91d2956 100644 --- a/tests/baselines/reference/promiseIdentityWithAny2.errors.txt +++ b/tests/baselines/reference/promiseIdentityWithAny2.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/promiseIdentityWithAny2.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise', but here has type 'Promise'. -tests/cases/compiler/promiseIdentityWithAny2.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'IPromise2', but here has type 'Promise2'. +tests/cases/compiler/promiseIdentityWithAny2.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'IPromise' at tests/cases/compiler/promiseIdentityWithAny2.ts 8:4, but here has type 'Promise'. +tests/cases/compiler/promiseIdentityWithAny2.ts(22,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'IPromise2' at tests/cases/compiler/promiseIdentityWithAny2.ts 20:4, but here has type 'Promise2'. ==== tests/cases/compiler/promiseIdentityWithAny2.ts (2 errors) ==== @@ -14,7 +14,7 @@ tests/cases/compiler/promiseIdentityWithAny2.ts(22,5): error TS2403: Subsequent var x: IPromise; var x: Promise; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'IPromise', but here has type 'Promise'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'IPromise' at tests/cases/compiler/promiseIdentityWithAny2.ts 8:4, but here has type 'Promise'. interface IPromise2 { @@ -28,4 +28,4 @@ tests/cases/compiler/promiseIdentityWithAny2.ts(22,5): error TS2403: Subsequent var y: IPromise2; var y: Promise2; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'IPromise2', but here has type 'Promise2'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'IPromise2' at tests/cases/compiler/promiseIdentityWithAny2.ts 20:4, but here has type 'Promise2'. \ No newline at end of file diff --git a/tests/baselines/reference/propertyAccess.errors.txt b/tests/baselines/reference/propertyAccess.errors.txt index a183ad79c1129..2ac87bc0e3e8f 100644 --- a/tests/baselines/reference/propertyAccess.errors.txt +++ b/tests/baselines/reference/propertyAccess.errors.txt @@ -4,7 +4,7 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(45,14): err tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(80,19): error TS2538: Type '{ name: string; }' cannot be used as an index type. tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(117,18): error TS2538: Type '{ name: string; }' cannot be used as an index type. tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(140,22): error TS2538: Type '{ name: string; }' cannot be used as an index type. -tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(149,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'A | B', but here has type 'A'. +tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(149,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' has type 'A | B' at tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts 147:4, but here has type 'A'. ==== tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts (6 errors) ==== @@ -169,5 +169,5 @@ tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts(149,5): err var x3 = bothIndex[stringOrNumber]; var x3: A; ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' must be of type 'A | B', but here has type 'A'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x3' has type 'A | B' at tests/cases/conformance/expressions/propertyAccess/propertyAccess.ts 147:4, but here has type 'A'. \ No newline at end of file diff --git a/tests/baselines/reference/propertyIdentityWithPrivacyMismatch.errors.txt b/tests/baselines/reference/propertyIdentityWithPrivacyMismatch.errors.txt index 4c5644f6b767d..ad421dbc1f6cf 100644 --- a/tests/baselines/reference/propertyIdentityWithPrivacyMismatch.errors.txt +++ b/tests/baselines/reference/propertyIdentityWithPrivacyMismatch.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'Foo', but here has type 'Foo'. -tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'Foo1', but here has type 'Foo2'. +tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'Foo' at tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts 3:4, but here has type 'Foo'. +tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'Foo1' at tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts 11:4, but here has type 'Foo2'. ==== tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts (2 errors) ==== @@ -9,7 +9,7 @@ tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(13,5): error TS240 var x: m1.Foo; var x: m2.Foo; // Should be error (mod1.Foo !== mod2.Foo) ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'Foo', but here has type 'Foo'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'Foo' at tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts 3:4, but here has type 'Foo'. class Foo1 { private n; } @@ -19,7 +19,7 @@ tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts(13,5): error TS240 var y: Foo1; var y: Foo2; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'Foo1', but here has type 'Foo2'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'Foo1' at tests/cases/compiler/propertyIdentityWithPrivacyMismatch_1.ts 11:4, but here has type 'Foo2'. ==== tests/cases/compiler/propertyIdentityWithPrivacyMismatch_0.ts (0 errors) ==== declare module 'mod1' { class Foo { diff --git a/tests/baselines/reference/reassignStaticProp.errors.txt b/tests/baselines/reference/reassignStaticProp.errors.txt index 7f67a6e7fc316..4a698eddab760 100644 --- a/tests/baselines/reference/reassignStaticProp.errors.txt +++ b/tests/baselines/reference/reassignStaticProp.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2300: Duplicate identifier 'bar'. -tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2403: Subsequent variable declarations must have the same type. Variable 'bar' must be of type 'number', but here has type 'string'. +tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2403: Subsequent variable declarations must have the same type. Variable 'bar' has type 'number' at tests/cases/compiler/reassignStaticProp.ts 2:11, but here has type 'string'. ==== tests/cases/compiler/reassignStaticProp.ts (2 errors) ==== @@ -11,7 +11,7 @@ tests/cases/compiler/reassignStaticProp.ts(5,12): error TS2403: Subsequent varia ~~~ !!! error TS2300: Duplicate identifier 'bar'. ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'bar' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'bar' has type 'number' at tests/cases/compiler/reassignStaticProp.ts 2:11, but here has type 'string'. } diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.errors.txt b/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.errors.txt index 1845d2e9775f2..301626123f280 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.errors.txt +++ b/tests/baselines/reference/typeGuardOfFormTypeOfEqualEqualHasNoEffect.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'string', but here has type 'number'. -tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(20,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'boolean', but here has type 'string'. -tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(27,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'number', but here has type 'boolean'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' has type 'string' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 9:8, but here has type 'number'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(20,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' has type 'boolean' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 16:8, but here has type 'string'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(27,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' has type 'number' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 23:8, but here has type 'boolean'. tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(30,5): error TS2365: Operator '==' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'. -tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(34,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'C', but here has type 'string'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts(34,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'C' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 30:8, but here has type 'string'. ==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts (5 errors) ==== @@ -20,7 +20,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa else { var r1 = strOrNum; // string | number ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'string', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' has type 'string' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 9:8, but here has type 'number'. } if (typeof strOrBool == "boolean") { @@ -29,7 +29,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa else { var r2 = strOrBool; // string | boolean ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'boolean', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' has type 'boolean' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 16:8, but here has type 'string'. } if (typeof numOrBool == "number") { @@ -38,7 +38,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa else { var r3 = numOrBool; // number | boolean ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'number', but here has type 'boolean'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' has type 'number' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 23:8, but here has type 'boolean'. } if (typeof strOrC == "Object") { @@ -49,5 +49,5 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHa else { var r4 = strOrC; // string | C ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'C', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'C' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfEqualEqualHasNoEffect.ts 30:8, but here has type 'string'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.errors.txt b/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.errors.txt index 1814abec82380..34ea96e2e1fd9 100644 --- a/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.errors.txt +++ b/tests/baselines/reference/typeGuardOfFormTypeOfNotEqualHasNoEffect.errors.txt @@ -1,8 +1,8 @@ -tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'number', but here has type 'string'. -tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(20,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'string', but here has type 'boolean'. -tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(27,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'boolean', but here has type 'number'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(13,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' has type 'number' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 9:8, but here has type 'string'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(20,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' has type 'string' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 16:8, but here has type 'boolean'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(27,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' has type 'boolean' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 23:8, but here has type 'number'. tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(30,5): error TS2365: Operator '!=' cannot be applied to types '"string" | "number" | "boolean" | "symbol" | "undefined" | "object" | "function"' and '"Object"'. -tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(34,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'string', but here has type 'C'. +tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts(34,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'string' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 30:8, but here has type 'C'. ==== tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts (5 errors) ==== @@ -20,7 +20,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN else { var r1 = strOrNum; // string | number ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' must be of type 'number', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r1' has type 'number' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 9:8, but here has type 'string'. } if (typeof strOrBool != "boolean") { @@ -29,7 +29,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN else { var r2 = strOrBool; // string | boolean ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' must be of type 'string', but here has type 'boolean'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r2' has type 'string' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 16:8, but here has type 'boolean'. } if (typeof numOrBool != "number") { @@ -38,7 +38,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN else { var r3 = numOrBool; // number | boolean ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' must be of type 'boolean', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r3' has type 'boolean' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 23:8, but here has type 'number'. } if (typeof strOrC != "Object") { @@ -49,5 +49,5 @@ tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasN else { var r4 = strOrC; // string | C ~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' must be of type 'string', but here has type 'C'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'r4' has type 'string' at tests/cases/conformance/expressions/typeGuards/typeGuardOfFormTypeOfNotEqualHasNoEffect.ts 30:8, but here has type 'C'. } \ No newline at end of file diff --git a/tests/baselines/reference/typeOfEnumAndVarRedeclarations.errors.txt b/tests/baselines/reference/typeOfEnumAndVarRedeclarations.errors.txt index 89849d3a614a8..8471efb50f3ed 100644 --- a/tests/baselines/reference/typeOfEnumAndVarRedeclarations.errors.txt +++ b/tests/baselines/reference/typeOfEnumAndVarRedeclarations.errors.txt @@ -1,5 +1,5 @@ -tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'. -tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'. +tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'typeof E' at tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts 6:4, but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'. +tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'typeof E' at tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts 8:4, but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'. tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,70): error TS2375: Duplicate number index signature. @@ -13,10 +13,10 @@ tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,70): error TS2375: Dup var x = E; var x: { readonly a: E; readonly b: E; readonly [x: number]: string; }; // Shouldnt error ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'typeof E' at tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts 6:4, but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'. var y = E; var y: { readonly a: E; readonly b: E; readonly [x: number]: string; readonly [x: number]: string } // two errors: the types are not identical and duplicate signatures ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'y' has type 'typeof E' at tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts 8:4, but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2375: Duplicate number index signature. \ No newline at end of file diff --git a/tests/baselines/reference/typeOfThis.errors.txt b/tests/baselines/reference/typeOfThis.errors.txt index 83d450570fce9..1dc76a40c17d6 100644 --- a/tests/baselines/reference/typeOfThis.errors.txt +++ b/tests/baselines/reference/typeOfThis.errors.txt @@ -1,19 +1,19 @@ -tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(14,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyTestClass'. -tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(18,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'. +tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(14,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 12:15, but here has type 'MyTestClass'. +tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(18,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 16:12, but here has type 'MyTestClass'. tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(22,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(24,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'. +tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(24,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 22:12, but here has type 'MyTestClass'. tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(27,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(29,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'. -tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(37,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyTestClass'. +tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(29,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 27:12, but here has type 'MyTestClass'. +tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(37,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 35:12, but here has type 'MyTestClass'. tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(53,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(61,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(83,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyGenericTestClass'. -tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(87,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass'. +tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(83,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 81:15, but here has type 'MyGenericTestClass'. +tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(87,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 85:12, but here has type 'MyGenericTestClass'. tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(91,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(93,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass'. +tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(93,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 91:12, but here has type 'MyGenericTestClass'. tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(96,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(98,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass'. -tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(106,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyGenericTestClass'. +tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(98,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 96:12, but here has type 'MyGenericTestClass'. +tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(106,13): error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 104:12, but here has type 'MyGenericTestClass'. tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(122,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. @@ -34,13 +34,13 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1 memberFunc(t = this) { var t: MyTestClass; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyTestClass'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 12:15, but here has type 'MyTestClass'. //type of 'this' in member function body is the class instance type var p = this; var p: MyTestClass; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 16:12, but here has type 'MyTestClass'. } //type of 'this' in member accessor(get and set) body is the class instance type @@ -50,7 +50,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1 var p = this; var p: MyTestClass; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 22:12, but here has type 'MyTestClass'. return this; } set prop(v) { @@ -59,7 +59,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1 var p = this; var p: MyTestClass; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyTestClass'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 27:12, but here has type 'MyTestClass'. p = v; v = p; } @@ -69,7 +69,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1 var t = this; var t: MyTestClass; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyTestClass'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 35:12, but here has type 'MyTestClass'. }; //type of 'this' in static function param list is constructor function type @@ -121,13 +121,13 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1 memberFunc(t = this) { var t: MyGenericTestClass; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyGenericTestClass'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 81:15, but here has type 'MyGenericTestClass'. //type of 'this' in member function body is the class instance type var p = this; var p: MyGenericTestClass; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 85:12, but here has type 'MyGenericTestClass'. } //type of 'this' in member accessor(get and set) body is the class instance type @@ -137,7 +137,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1 var p = this; var p: MyGenericTestClass; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 91:12, but here has type 'MyGenericTestClass'. return this; } set prop(v) { @@ -146,7 +146,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1 var p = this; var p: MyGenericTestClass; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' must be of type 'this', but here has type 'MyGenericTestClass'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'p' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 96:12, but here has type 'MyGenericTestClass'. p = v; v = p; } @@ -156,7 +156,7 @@ tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts(130,16): error TS1 var t = this; var t: MyGenericTestClass; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' must be of type 'this', but here has type 'MyGenericTestClass'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 't' has type 'this' at tests/cases/conformance/expressions/thisKeyword/typeOfThis.ts 104:12, but here has type 'MyGenericTestClass'. }; //type of 'this' in static function param list is constructor function type diff --git a/tests/baselines/reference/unionTypeEquivalence.errors.txt b/tests/baselines/reference/unionTypeEquivalence.errors.txt index d561a96f97e1d..724e3ecec93c7 100644 --- a/tests/baselines/reference/unionTypeEquivalence.errors.txt +++ b/tests/baselines/reference/unionTypeEquivalence.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/types/union/unionTypeEquivalence.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'C', but here has type 'C | D'. +tests/cases/conformance/types/union/unionTypeEquivalence.ts(5,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'C' at tests/cases/conformance/types/union/unionTypeEquivalence.ts 3:4, but here has type 'C | D'. ==== tests/cases/conformance/types/union/unionTypeEquivalence.ts (1 errors) ==== @@ -8,7 +8,7 @@ tests/cases/conformance/types/union/unionTypeEquivalence.ts(5,5): error TS2403: var x: C; var x : C | D; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' must be of type 'C', but here has type 'C | D'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'x' has type 'C' at tests/cases/conformance/types/union/unionTypeEquivalence.ts 3:4, but here has type 'C | D'. // A | B is equivalent to B | A. var y: string | number; diff --git a/tests/baselines/reference/unionTypeIdentity.errors.txt b/tests/baselines/reference/unionTypeIdentity.errors.txt index 77d25bd78d1f7..afa4eb844c1ad 100644 --- a/tests/baselines/reference/unionTypeIdentity.errors.txt +++ b/tests/baselines/reference/unionTypeIdentity.errors.txt @@ -1,6 +1,6 @@ -tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'string'. -tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts(7,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'boolean'. -tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'number'. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts(6,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' has type 'string | boolean' at tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts 2:4, but here has type 'string'. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts(7,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' has type 'string | boolean' at tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts 2:4, but here has type 'boolean'. +tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts(8,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' has type 'string | boolean' at tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts 2:4, but here has type 'number'. ==== tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts (3 errors) ==== @@ -11,10 +11,10 @@ tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeI var strOrNum: boolean | string | boolean; var strOrNum: string; // error ~~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' has type 'string | boolean' at tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts 2:4, but here has type 'string'. var strOrNum: boolean; // error ~~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'boolean'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' has type 'string | boolean' at tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts 2:4, but here has type 'boolean'. var strOrNum: number; // error ~~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' must be of type 'string | boolean', but here has type 'number'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'strOrNum' has type 'string | boolean' at tests/cases/conformance/types/typeRelationships/typeAndMemberIdentity/unionTypeIdentity.ts 2:4, but here has type 'number'. \ No newline at end of file diff --git a/tests/baselines/reference/unionTypeLiterals.errors.txt b/tests/baselines/reference/unionTypeLiterals.errors.txt index d976d769f5971..3eb1cde76c502 100644 --- a/tests/baselines/reference/unionTypeLiterals.errors.txt +++ b/tests/baselines/reference/unionTypeLiterals.errors.txt @@ -1,5 +1,5 @@ -tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'unionOfFunctionType' must be of type '(() => string) | (() => number)', but here has type '() => string | number'. -tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts(15,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'unionOfConstructorType' must be of type '(new () => string) | (new () => number)', but here has type 'new () => string | number'. +tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts(11,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'unionOfFunctionType' has type '(() => string) | (() => number)' at tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts 8:4, but here has type '() => string | number'. +tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts(15,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'unionOfConstructorType' has type '(new () => string) | (new () => number)' at tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts 12:4, but here has type 'new () => string | number'. ==== tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts (2 errors) ==== @@ -15,10 +15,10 @@ tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts( var unionOfFunctionType: { (): string } | { (): number }; var unionOfFunctionType: () => string | number; ~~~~~~~~~~~~~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'unionOfFunctionType' must be of type '(() => string) | (() => number)', but here has type '() => string | number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'unionOfFunctionType' has type '(() => string) | (() => number)' at tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts 8:4, but here has type '() => string | number'. var unionOfConstructorType: (new () => string) | (new () => number); var unionOfConstructorType: { new (): string } | { new (): number }; var unionOfConstructorType: new () => string | number; ~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'unionOfConstructorType' must be of type '(new () => string) | (new () => number)', but here has type 'new () => string | number'. \ No newline at end of file +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'unionOfConstructorType' has type '(new () => string) | (new () => number)' at tests/cases/conformance/types/specifyingTypes/typeLiterals/unionTypeLiterals.ts 12:4, but here has type 'new () => string | number'. \ No newline at end of file diff --git a/tests/baselines/reference/varBlock.errors.txt b/tests/baselines/reference/varBlock.errors.txt index 6746a760a44ee..5e80d0846dde2 100644 --- a/tests/baselines/reference/varBlock.errors.txt +++ b/tests/baselines/reference/varBlock.errors.txt @@ -16,7 +16,7 @@ tests/cases/compiler/varBlock.ts(33,25): error TS1039: Initializers are not allo tests/cases/compiler/varBlock.ts(34,19): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/compiler/varBlock.ts(35,25): error TS1039: Initializers are not allowed in ambient contexts. tests/cases/compiler/varBlock.ts(35,35): error TS1039: Initializers are not allowed in ambient contexts. -tests/cases/compiler/varBlock.ts(39,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'c' must be of type 'any', but here has type 'number'. +tests/cases/compiler/varBlock.ts(39,13): error TS2403: Subsequent variable declarations must have the same type. Variable 'c' has type 'any' at tests/cases/compiler/varBlock.ts 37:12, but here has type 'number'. tests/cases/compiler/varBlock.ts(39,15): error TS1039: Initializers are not allowed in ambient contexts. @@ -97,6 +97,6 @@ tests/cases/compiler/varBlock.ts(39,15): error TS1039: Initializers are not allo declare var c; declare var c = 10; ~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'c' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'c' has type 'any' at tests/cases/compiler/varBlock.ts 37:12, but here has type 'number'. ~ !!! error TS1039: Initializers are not allowed in ambient contexts. \ No newline at end of file diff --git a/tests/baselines/reference/witness.errors.txt b/tests/baselines/reference/witness.errors.txt index e24757411892b..87eca43ff785a 100644 --- a/tests/baselines/reference/witness.errors.txt +++ b/tests/baselines/reference/witness.errors.txt @@ -1,17 +1,17 @@ tests/cases/conformance/types/witness/witness.ts(4,21): error TS2372: Parameter 'pInit' cannot be referenced in its initializer. tests/cases/conformance/types/witness/witness.ts(28,12): error TS2695: Left side of comma operator is unused and has no side effects. -tests/cases/conformance/types/witness/witness.ts(29,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'co1' must be of type 'any', but here has type 'number'. +tests/cases/conformance/types/witness/witness.ts(29,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'co1' has type 'any' at tests/cases/conformance/types/witness/witness.ts 27:4, but here has type 'number'. tests/cases/conformance/types/witness/witness.ts(30,12): error TS2695: Left side of comma operator is unused and has no side effects. tests/cases/conformance/types/witness/witness.ts(30,12): error TS2695: Left side of comma operator is unused and has no side effects. tests/cases/conformance/types/witness/witness.ts(32,12): error TS2695: Left side of comma operator is unused and has no side effects. tests/cases/conformance/types/witness/witness.ts(32,12): error TS2695: Left side of comma operator is unused and has no side effects. tests/cases/conformance/types/witness/witness.ts(32,12): error TS2695: Left side of comma operator is unused and has no side effects. -tests/cases/conformance/types/witness/witness.ts(33,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'co3' must be of type 'any', but here has type 'number'. -tests/cases/conformance/types/witness/witness.ts(37,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'as1' must be of type 'any', but here has type 'number'. -tests/cases/conformance/types/witness/witness.ts(39,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'as2' must be of type 'any', but here has type 'number'. -tests/cases/conformance/types/witness/witness.ts(43,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'cnd1' must be of type 'any', but here has type 'number'. -tests/cases/conformance/types/witness/witness.ts(57,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'and1' must be of type 'any', but here has type 'string'. -tests/cases/conformance/types/witness/witness.ts(110,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'propAcc1' must be of type 'any', but here has type '{ m: any; }'. +tests/cases/conformance/types/witness/witness.ts(33,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'co3' has type 'any' at tests/cases/conformance/types/witness/witness.ts 31:4, but here has type 'number'. +tests/cases/conformance/types/witness/witness.ts(37,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'as1' has type 'any' at tests/cases/conformance/types/witness/witness.ts 35:4, but here has type 'number'. +tests/cases/conformance/types/witness/witness.ts(39,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'as2' has type 'any' at tests/cases/conformance/types/witness/witness.ts 37:4, but here has type 'number'. +tests/cases/conformance/types/witness/witness.ts(43,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'cnd1' has type 'any' at tests/cases/conformance/types/witness/witness.ts 41:4, but here has type 'number'. +tests/cases/conformance/types/witness/witness.ts(57,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'and1' has type 'any' at tests/cases/conformance/types/witness/witness.ts 55:4, but here has type 'string'. +tests/cases/conformance/types/witness/witness.ts(110,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'propAcc1' has type 'any' at tests/cases/conformance/types/witness/witness.ts 106:4, but here has type '{ m: any; }'. ==== tests/cases/conformance/types/witness/witness.ts (14 errors) ==== @@ -49,7 +49,7 @@ tests/cases/conformance/types/witness/witness.ts(110,5): error TS2403: Subsequen !!! error TS2695: Left side of comma operator is unused and has no side effects. var co1: number; ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'co1' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'co1' has type 'any' at tests/cases/conformance/types/witness/witness.ts 27:4, but here has type 'number'. var co2 = (3, 4, co2); ~ !!! error TS2695: Left side of comma operator is unused and has no side effects. @@ -65,23 +65,23 @@ tests/cases/conformance/types/witness/witness.ts(110,5): error TS2403: Subsequen !!! error TS2695: Left side of comma operator is unused and has no side effects. var co3: number; ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'co3' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'co3' has type 'any' at tests/cases/conformance/types/witness/witness.ts 31:4, but here has type 'number'. // Assignment var as1 = (as1 = 2); var as1: number; ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'as1' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'as1' has type 'any' at tests/cases/conformance/types/witness/witness.ts 35:4, but here has type 'number'. var as2 = (as2 = as2 = 2); var as2: number; ~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'as2' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'as2' has type 'any' at tests/cases/conformance/types/witness/witness.ts 37:4, but here has type 'number'. // Conditional var cnd1 = cnd1 ? 0 : 1; var cnd1: number; ~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'cnd1' must be of type 'any', but here has type 'number'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'cnd1' has type 'any' at tests/cases/conformance/types/witness/witness.ts 41:4, but here has type 'number'. var cnd2 = cnd1 ? cnd1 ? '' : "" : ''; var cnd2: string; @@ -97,7 +97,7 @@ tests/cases/conformance/types/witness/witness.ts(110,5): error TS2403: Subsequen var and1 = and1 && ''; var and1: string; ~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'and1' must be of type 'any', but here has type 'string'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'and1' has type 'any' at tests/cases/conformance/types/witness/witness.ts 55:4, but here has type 'string'. var and2 = '' && and2; var and2: any; var and3 = and3 && and3; @@ -152,7 +152,7 @@ tests/cases/conformance/types/witness/witness.ts(110,5): error TS2403: Subsequen }; var propAcc1: { m: any; } ~~~~~~~~ -!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'propAcc1' must be of type 'any', but here has type '{ m: any; }'. +!!! error TS2403: Subsequent variable declarations must have the same type. Variable 'propAcc1' has type 'any' at tests/cases/conformance/types/witness/witness.ts 106:4, but here has type '{ m: any; }'. // Property access of module member module M2 { From e5d8216f4bca6bae43870854ad9ea0f82b8aa520 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Fri, 20 Oct 2017 07:28:59 -0700 Subject: [PATCH 2/2] Fix naming, remove template literal --- src/compiler/checker.ts | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index a9855f8d84f57..5798eaa56fe0a 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4417,7 +4417,7 @@ namespace ts { jsDocType = declarationType; } else if (jsDocType !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(jsDocType, declarationType)) { - errorSubsequentVariableDeclarationMustHaveSameType(symbol.valueDeclaration, jsDocType, declaration, declarationType); + errorNextVariableDeclarationMustHaveSameType(symbol.valueDeclaration, jsDocType, declaration, declarationType); } } else if (!jsDocType) { @@ -20778,7 +20778,7 @@ namespace ts { // initializer is consistent with type associated with the node const declarationType = convertAutoToAny(getWidenedTypeForVariableLikeDeclaration(node)); if (type !== unknownType && declarationType !== unknownType && !isTypeIdenticalTo(type, declarationType)) { - errorSubsequentVariableDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType); + errorNextVariableDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType); } if (node.initializer) { checkTypeAssignableTo(checkExpressionCached(node.initializer), declarationType, node, /*headMessage*/ undefined); @@ -20802,19 +20802,19 @@ namespace ts { } } - function errorSubsequentVariableDeclarationMustHaveSameType(firstDeclaration: Declaration, firstType: Type, nextDeclaration: Declaration, subsequentType: Type): void { - const valueDeclarationSourceFile = getSourceFileOfNode(firstDeclaration); - const otherSpan = getErrorSpanForNode(valueDeclarationSourceFile, getNameOfDeclaration(firstDeclaration) || firstDeclaration); - const otherLocation = getLineAndCharacterOfPosition(valueDeclarationSourceFile, otherSpan.start); - const otherLocationDescription = `${valueDeclarationSourceFile.fileName} ${otherLocation.line}:${otherLocation.character}`; + function errorNextVariableDeclarationMustHaveSameType(firstDeclaration: Declaration, firstType: Type, nextDeclaration: Declaration, nextType: Type): void { + const firstSourceFile = getSourceFileOfNode(firstDeclaration); + const firstSpan = getErrorSpanForNode(firstSourceFile, getNameOfDeclaration(firstDeclaration) || firstDeclaration); + const firstLocation = getLineAndCharacterOfPosition(firstSourceFile, firstSpan.start); + const firstLocationDescription = firstSourceFile.fileName + " " + firstLocation.line + ":" + firstLocation.character; const nextDeclarationName = getNameOfDeclaration(nextDeclaration); error( nextDeclarationName, Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_has_type_1_at_2_but_here_has_type_3, declarationNameToString(nextDeclarationName), typeToString(firstType), - otherLocationDescription, - typeToString(subsequentType)); + firstLocationDescription, + typeToString(nextType)); } function areDeclarationFlagsIdentical(left: Declaration, right: Declaration) {