From cf057a1d226536c966f686820361e79d95f98d6a Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 8 May 2017 12:30:04 -0400 Subject: [PATCH 1/6] Use damerau-levenshtein algorithm for edit distance --- src/compiler/checker.ts | 4 +- src/compiler/utilities.ts | 38 +++++++++++++------ .../compiler/suggestionRankingPreferences.ts | 3 ++ 3 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 tests/cases/compiler/suggestionRankingPreferences.ts diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index eaa28767166c2..87d5f9e97110d 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -14301,11 +14301,11 @@ namespace ts { candidateName === "set") { continue; } - const distance = levenshtein(name, candidateName); + const distance = dameraulevenshtein(name, candidateName); if (distance > worstDistance) { continue; } - if (distance < 3) { + if (distance <= MIN_LEV_DIST) { return candidate; } else if (distance < bestDistance) { diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a859fde9cc1ec..e35f5d51c6098 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4642,26 +4642,40 @@ namespace ts { return identifier.length >= 3 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ && identifier.charCodeAt(2) === CharacterCodes._ ? identifier.substr(1) : identifier; } - export function levenshtein(s1: string, s2: string): number { - let previous: number[] = new Array(s2.length + 1); - let current: number[] = new Array(s2.length + 1); - for (let i = 0; i < s2.length + 1; i++) { + const CHANGE_COST = 1; + const INSERT_COST = 1; + const DELETE_COST = 1; + const TRANSPOSE_COST = 0.95; // Transpositions slightly cheaper than insertion/deletion/substitution to promote transposed errors + export const MIN_LEV_DIST = TRANSPOSE_COST; + export function dameraulevenshtein(s1: string, s2: string): number { + const rowLength = s2.length + 1; + let prevprev: number[] = new Array(rowLength); + let previous: number[] = new Array(rowLength); + let current: number[] = new Array(rowLength); + for (let i = 0; i < rowLength; i++) { + prevprev[i] = Infinity; previous[i] = i; - current[i] = -1; } + for (let i = 1; i < s1.length + 1; i++) { current[0] = i; - for (let j = 1; j < s2.length + 1; j++) { - current[j] = Math.min( - previous[j] + 1, - current[j - 1] + 1, - previous[j - 1] + (s1[i - 1] === s2[j - 1] ? 0 : 2)); + for (let j = 1; j < rowLength; j++) { + const eq = s1.charCodeAt(i - 1) === s2.charCodeAt(j - 1); + let min = previous[j] + DELETE_COST; + let tmp = current[j - 1] + INSERT_COST; + if (tmp < min) min = tmp; + if ((tmp = previous[j - 1] + (eq ? 0 : CHANGE_COST)) < min) min = tmp; + if ((tmp = (i > 1 && j > 1 && s1.charCodeAt(i - 1) === s2.charCodeAt(j - 2) && s1.charCodeAt(i - 2) === s2.charCodeAt(j - 1)) ? (prevprev[j - 2] + (eq ? 0 : TRANSPOSE_COST)) : Infinity) < min) min = tmp; + current[j] = min; } + // shift current back to previous, and then reuse previous' array - const tmp = previous; + const tmp = prevprev; + prevprev = previous; previous = current; current = tmp; } - return previous[previous.length - 1]; + + return previous[rowLength - 1]; } } diff --git a/tests/cases/compiler/suggestionRankingPreferences.ts b/tests/cases/compiler/suggestionRankingPreferences.ts new file mode 100644 index 0000000000000..cc31399bff22f --- /dev/null +++ b/tests/cases/compiler/suggestionRankingPreferences.ts @@ -0,0 +1,3 @@ +var twnty; +var twenty; +var which = tewnty; \ No newline at end of file From 21dc0bbc38019e69076576872f6cb790c709bfe2 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Mon, 8 May 2017 20:47:21 -0400 Subject: [PATCH 2/6] Accept new suggestion baselines --- ...ExportedAndNonExportedFunctions.errors.txt | 4 +- .../baselines/reference/autoLift2.errors.txt | 12 +++--- ...torWithIncompleteTypeAnnotation.errors.txt | 8 ++-- ...IntypeCheckInvocationExpression.errors.txt | 4 +- .../letDeclarations-scopes2.errors.txt | 4 +- .../reference/parserRealSource7.errors.txt | 16 ++++---- .../reference/scannertest1.errors.txt | 40 +++++++++---------- .../suggestionRankingPreferences.errors.txt | 9 +++++ .../reference/suggestionRankingPreferences.js | 9 +++++ .../tsxAttributeInvalidNames.errors.txt | 8 ++-- ...nstanceOfByConstructorSignature.errors.txt | 16 ++++---- 11 files changed, 74 insertions(+), 56 deletions(-) create mode 100644 tests/baselines/reference/suggestionRankingPreferences.errors.txt create mode 100644 tests/baselines/reference/suggestionRankingPreferences.js diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.errors.txt b/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.errors.txt index 96864565d85e9..bf143b9224d7c 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.errors.txt +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedFunctions.ts(28,13): error TS2339: Property 'fn2' does not exist on type 'typeof A'. +tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedFunctions.ts(28,13): error TS2551: Property 'fn2' does not exist on type 'typeof A'. Did you mean 'fng'? tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedFunctions.ts(29,14): error TS2551: Property 'fng2' does not exist on type 'typeof A'. Did you mean 'fng'? @@ -32,7 +32,7 @@ tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAnd // these should be errors since the functions are not exported var fn2 = A.fn2; ~~~ -!!! error TS2339: Property 'fn2' does not exist on type 'typeof A'. +!!! error TS2551: Property 'fn2' does not exist on type 'typeof A'. Did you mean 'fng'? var fng2 = A.fng2; ~~~~ !!! error TS2551: Property 'fng2' does not exist on type 'typeof A'. Did you mean 'fng'? \ No newline at end of file diff --git a/tests/baselines/reference/autoLift2.errors.txt b/tests/baselines/reference/autoLift2.errors.txt index 63d1c2c3548b3..4e07c1c92f5f2 100644 --- a/tests/baselines/reference/autoLift2.errors.txt +++ b/tests/baselines/reference/autoLift2.errors.txt @@ -1,13 +1,13 @@ tests/cases/compiler/autoLift2.ts(5,14): error TS2339: Property 'foo' does not exist on type 'A'. tests/cases/compiler/autoLift2.ts(5,17): error TS1005: ';' expected. tests/cases/compiler/autoLift2.ts(5,19): error TS2693: 'any' only refers to a type, but is being used as a value here. -tests/cases/compiler/autoLift2.ts(6,14): error TS2339: Property 'bar' does not exist on type 'A'. +tests/cases/compiler/autoLift2.ts(6,14): error TS2551: Property 'bar' does not exist on type 'A'. Did you mean 'baz'? tests/cases/compiler/autoLift2.ts(6,17): error TS1005: ';' expected. tests/cases/compiler/autoLift2.ts(6,19): error TS2693: 'any' only refers to a type, but is being used as a value here. tests/cases/compiler/autoLift2.ts(12,11): error TS2339: Property 'foo' does not exist on type 'A'. -tests/cases/compiler/autoLift2.ts(14,11): error TS2339: Property 'bar' does not exist on type 'A'. +tests/cases/compiler/autoLift2.ts(14,11): error TS2551: Property 'bar' does not exist on type 'A'. Did you mean 'baz'? tests/cases/compiler/autoLift2.ts(16,33): error TS2339: Property 'foo' does not exist on type 'A'. -tests/cases/compiler/autoLift2.ts(18,33): error TS2339: Property 'bar' does not exist on type 'A'. +tests/cases/compiler/autoLift2.ts(18,33): error TS2551: Property 'bar' does not exist on type 'A'. Did you mean 'baz'? ==== tests/cases/compiler/autoLift2.ts (10 errors) ==== @@ -24,7 +24,7 @@ tests/cases/compiler/autoLift2.ts(18,33): error TS2339: Property 'bar' does not !!! error TS2693: 'any' only refers to a type, but is being used as a value here. this.bar: any; ~~~ -!!! error TS2339: Property 'bar' does not exist on type 'A'. +!!! error TS2551: Property 'bar' does not exist on type 'A'. Did you mean 'baz'? ~ !!! error TS1005: ';' expected. ~~~ @@ -40,7 +40,7 @@ tests/cases/compiler/autoLift2.ts(18,33): error TS2339: Property 'bar' does not this.bar = "bar"; ~~~ -!!! error TS2339: Property 'bar' does not exist on type 'A'. +!!! error TS2551: Property 'bar' does not exist on type 'A'. Did you mean 'baz'? [1, 2].forEach((p) => this.foo); ~~~ @@ -48,7 +48,7 @@ tests/cases/compiler/autoLift2.ts(18,33): error TS2339: Property 'bar' does not [1, 2].forEach((p) => this.bar); ~~~ -!!! error TS2339: Property 'bar' does not exist on type 'A'. +!!! error TS2551: Property 'bar' does not exist on type 'A'. Did you mean 'baz'? } diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index 1d37b20a3b3e8..5551fe5a9ae4f 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -64,12 +64,12 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,21): error T tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,44): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,69): error TS1110: Type expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,9): error TS1128: Declaration or statement expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,16): error TS2304: Cannot find name 'Overloads'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,16): error TS2552: Cannot find name 'Overloads'. Did you mean 'Overloading'? tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,26): error TS2304: Cannot find name 'value'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,31): error TS1005: ',' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,33): error TS2693: 'string' only refers to a type, but is being used as a value here. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,9): error TS1128: Declaration or statement expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,16): error TS2304: Cannot find name 'Overloads'. +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,16): error TS2552: Cannot find name 'Overloads'. Did you mean 'Overloading'? tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,27): error TS1135: Argument expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,33): error TS1005: '(' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,35): error TS2693: 'string' only refers to a type, but is being used as a value here. @@ -480,7 +480,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS ~~~~~~ !!! error TS1128: Declaration or statement expected. ~~~~~~~~~ -!!! error TS2304: Cannot find name 'Overloads'. +!!! error TS2552: Cannot find name 'Overloads'. Did you mean 'Overloading'? ~~~~~ !!! error TS2304: Cannot find name 'value'. ~ @@ -491,7 +491,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS ~~~~~~ !!! error TS1128: Declaration or statement expected. ~~~~~~~~~ -!!! error TS2304: Cannot find name 'Overloads'. +!!! error TS2552: Cannot find name 'Overloads'. Did you mean 'Overloading'? ~~~~~ !!! error TS1135: Argument expression expected. ~ diff --git a/tests/baselines/reference/crashIntypeCheckInvocationExpression.errors.txt b/tests/baselines/reference/crashIntypeCheckInvocationExpression.errors.txt index a1f5afbde13f8..e1bcb5fcb6908 100644 --- a/tests/baselines/reference/crashIntypeCheckInvocationExpression.errors.txt +++ b/tests/baselines/reference/crashIntypeCheckInvocationExpression.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(6,28): error TS2304: Cannot find name 'task'. -tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(8,18): error TS2304: Cannot find name 'path'. +tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(8,18): error TS2552: Cannot find name 'path'. Did you mean 'Math'? tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(9,19): error TS2347: Untyped function calls may not accept type arguments. tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(10,50): error TS2304: Cannot find name 'moduleType'. @@ -16,7 +16,7 @@ tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(10,50): error TS230 var folder = path.join(), ~~~~ -!!! error TS2304: Cannot find name 'path'. +!!! error TS2552: Cannot find name 'path'. Did you mean 'Math'? fileset = nake.fileSetSync(folder) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2347: Untyped function calls may not accept type arguments. diff --git a/tests/baselines/reference/letDeclarations-scopes2.errors.txt b/tests/baselines/reference/letDeclarations-scopes2.errors.txt index 5da8d99d397c1..617f69fd661df 100644 --- a/tests/baselines/reference/letDeclarations-scopes2.errors.txt +++ b/tests/baselines/reference/letDeclarations-scopes2.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/letDeclarations-scopes2.ts(8,5): error TS2552: Cannot find name 'local2'. Did you mean 'local'? tests/cases/compiler/letDeclarations-scopes2.ts(20,5): error TS2552: Cannot find name 'local2'. Did you mean 'local'? -tests/cases/compiler/letDeclarations-scopes2.ts(23,1): error TS2304: Cannot find name 'local'. +tests/cases/compiler/letDeclarations-scopes2.ts(23,1): error TS2552: Cannot find name 'local'. Did you mean 'global'? tests/cases/compiler/letDeclarations-scopes2.ts(25,1): error TS2304: Cannot find name 'local2'. @@ -33,7 +33,7 @@ tests/cases/compiler/letDeclarations-scopes2.ts(25,1): error TS2304: Cannot find local; // Error ~~~~~ -!!! error TS2304: Cannot find name 'local'. +!!! error TS2552: Cannot find name 'local'. Did you mean 'global'? global; // OK local2; // Error ~~~~~~ diff --git a/tests/baselines/reference/parserRealSource7.errors.txt b/tests/baselines/reference/parserRealSource7.errors.txt index 1261d7b5f0655..51d8a1945e5e5 100644 --- a/tests/baselines/reference/parserRealSource7.errors.txt +++ b/tests/baselines/reference/parserRealSource7.errors.txt @@ -71,7 +71,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(206,48): error T tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(206,66): error TS2304: Cannot find name 'DualStringHashTable'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(206,90): error TS2304: Cannot find name 'StringHashTable'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(206,113): error TS2304: Cannot find name 'StringHashTable'. -tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(207,31): error TS2304: Cannot find name 'ModuleType'. +tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(207,31): error TS2552: Cannot find name 'ModuleType'. Did you mean 'moduleDecl'? tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(209,42): error TS2304: Cannot find name 'TypeFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(211,39): error TS2304: Cannot find name 'ScopedMembers'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(211,57): error TS2304: Cannot find name 'DualStringHashTable'. @@ -100,7 +100,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(250,82): error T tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(251,38): error TS2304: Cannot find name 'ScopedMembers'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(251,56): error TS2304: Cannot find name 'DualStringHashTable'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(251,107): error TS2304: Cannot find name 'StringHashTable'. -tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(253,27): error TS2304: Cannot find name 'ModuleType'. +tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(253,27): error TS2552: Cannot find name 'ModuleType'. Did you mean 'moduleDecl'? tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(255,38): error TS2304: Cannot find name 'TypeFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(272,33): error TS2304: Cannot find name 'SymbolFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(276,33): error TS2304: Cannot find name 'SymbolFlags'. @@ -196,7 +196,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(476,57): error T tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(477,29): error TS2304: Cannot find name 'ValueLocation'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(478,29): error TS2304: Cannot find name 'hasFlag'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(478,55): error TS2304: Cannot find name 'VarFlags'. -tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(480,21): error TS2552: Cannot find name 'FieldSymbol'. Did you mean 'fieldSymbol'? +tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(480,21): error TS2304: Cannot find name 'FieldSymbol'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(482,34): error TS2304: Cannot find name 'hasFlag'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(482,60): error TS2304: Cannot find name 'VarFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(492,30): error TS2304: Cannot find name 'getTypeLink'. @@ -218,7 +218,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(507,26): error T tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(507,52): error TS2304: Cannot find name 'ASTFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(518,22): error TS2304: Cannot find name 'FieldSymbol'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(531,29): error TS2304: Cannot find name 'ValueLocation'. -tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(533,21): error TS2552: Cannot find name 'FieldSymbol'. Did you mean 'fieldSymbol'? +tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(533,21): error TS2304: Cannot find name 'FieldSymbol'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(535,53): error TS2304: Cannot find name 'VarFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(535,75): error TS2304: Cannot find name 'VarFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(539,38): error TS2304: Cannot find name 'SymbolFlags'. @@ -658,7 +658,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(828,13): error T !!! error TS2304: Cannot find name 'StringHashTable'. modType = new ModuleType(enclosedTypes, ambientEnclosedTypes); ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'ModuleType'. +!!! error TS2552: Cannot find name 'ModuleType'. Did you mean 'moduleDecl'? if (isEnum) { modType.typeFlags |= TypeFlags.IsEnum; ~~~~~~~~~ @@ -762,7 +762,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(828,13): error T modType = new ModuleType(enclosedTypes, ambientEnclosedTypes); ~~~~~~~~~~ -!!! error TS2304: Cannot find name 'ModuleType'. +!!! error TS2552: Cannot find name 'ModuleType'. Did you mean 'moduleDecl'? if (isEnum) { modType.typeFlags |= TypeFlags.IsEnum; ~~~~~~~~~ @@ -1181,7 +1181,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(828,13): error T var fieldSymbol = new FieldSymbol(argDecl.id.text, argDecl.minChar, ~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'FieldSymbol'. Did you mean 'fieldSymbol'? +!!! error TS2304: Cannot find name 'FieldSymbol'. context.checker.locationInfo.unitIndex, !hasFlag(argDecl.varFlags, VarFlags.Readonly), ~~~~~~~ @@ -1278,7 +1278,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(828,13): error T var fieldSymbol = new FieldSymbol(varDecl.id.text, varDecl.minChar, ~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'FieldSymbol'. Did you mean 'fieldSymbol'? +!!! error TS2304: Cannot find name 'FieldSymbol'. context.checker.locationInfo.unitIndex, (varDecl.varFlags & VarFlags.Readonly) == VarFlags.None, ~~~~~~~~ diff --git a/tests/baselines/reference/scannertest1.errors.txt b/tests/baselines/reference/scannertest1.errors.txt index fce2a0b292a22..8da2524209483 100644 --- a/tests/baselines/reference/scannertest1.errors.txt +++ b/tests/baselines/reference/scannertest1.errors.txt @@ -1,18 +1,18 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(1,1): error TS6053: File 'tests/cases/conformance/scanner/ecmascript5/References.ts' not found. -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(5,21): error TS2304: Cannot find name 'CharacterCodes'. -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(5,47): error TS2304: Cannot find name 'CharacterCodes'. +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(5,21): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(5,47): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(9,16): error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'? -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(10,22): error TS2304: Cannot find name 'CharacterCodes'. -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(10,47): error TS2304: Cannot find name 'CharacterCodes'. -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(11,22): error TS2304: Cannot find name 'CharacterCodes'. -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(11,47): error TS2304: Cannot find name 'CharacterCodes'. +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(10,22): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(10,47): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(11,22): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(11,47): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(15,9): error TS2304: Cannot find name 'Debug'. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(15,22): error TS2662: Cannot find name 'isHexDigit'. Did you mean the static member 'CharacterInfo.isHexDigit'? tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(16,16): error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'? -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(17,20): error TS2304: Cannot find name 'CharacterCodes'. -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(18,21): error TS2304: Cannot find name 'CharacterCodes'. -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(18,46): error TS2304: Cannot find name 'CharacterCodes'. -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(19,23): error TS2304: Cannot find name 'CharacterCodes'. +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(17,20): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(18,21): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(18,46): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(19,23): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(20,23): error TS2304: Cannot find name 'CharacterCodes'. @@ -25,9 +25,9 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(20,23): error TS2304 public static isDecimalDigit(c: number): boolean { return c >= CharacterCodes._0 && c <= CharacterCodes._9; ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CharacterCodes'. +!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CharacterCodes'. +!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? } public static isHexDigit(c: number): boolean { @@ -36,14 +36,14 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(20,23): error TS2304 !!! error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'? (c >= CharacterCodes.A && c <= CharacterCodes.F) || ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CharacterCodes'. +!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CharacterCodes'. +!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? (c >= CharacterCodes.a && c <= CharacterCodes.f); ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CharacterCodes'. +!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CharacterCodes'. +!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? } public static hexValue(c: number): number { @@ -57,15 +57,15 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(20,23): error TS2304 !!! error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'? ? (c - CharacterCodes._0) ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CharacterCodes'. +!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? : (c >= CharacterCodes.A && c <= CharacterCodes.F) ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CharacterCodes'. +!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CharacterCodes'. +!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? ? c - CharacterCodes.A + 10 ~~~~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'CharacterCodes'. +!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? : c - CharacterCodes.a + 10; ~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'CharacterCodes'. diff --git a/tests/baselines/reference/suggestionRankingPreferences.errors.txt b/tests/baselines/reference/suggestionRankingPreferences.errors.txt new file mode 100644 index 0000000000000..0102d0e8c8656 --- /dev/null +++ b/tests/baselines/reference/suggestionRankingPreferences.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/suggestionRankingPreferences.ts(3,13): error TS2552: Cannot find name 'tewnty'. Did you mean 'twenty'? + + +==== tests/cases/compiler/suggestionRankingPreferences.ts (1 errors) ==== + var twnty; + var twenty; + var which = tewnty; + ~~~~~~ +!!! error TS2552: Cannot find name 'tewnty'. Did you mean 'twenty'? \ No newline at end of file diff --git a/tests/baselines/reference/suggestionRankingPreferences.js b/tests/baselines/reference/suggestionRankingPreferences.js new file mode 100644 index 0000000000000..f5e5f80c92807 --- /dev/null +++ b/tests/baselines/reference/suggestionRankingPreferences.js @@ -0,0 +1,9 @@ +//// [suggestionRankingPreferences.ts] +var twnty; +var twenty; +var which = tewnty; + +//// [suggestionRankingPreferences.js] +var twnty; +var twenty; +var which = tewnty; diff --git a/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt b/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt index 0607a01a11c34..d6d7b2f277a7d 100644 --- a/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt +++ b/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt @@ -1,13 +1,13 @@ tests/cases/conformance/jsx/file.tsx(10,8): error TS1003: Identifier expected. tests/cases/conformance/jsx/file.tsx(10,10): error TS1005: ';' expected. -tests/cases/conformance/jsx/file.tsx(10,10): error TS2304: Cannot find name 'data'. +tests/cases/conformance/jsx/file.tsx(10,10): error TS2552: Cannot find name 'data'. Did you mean 'Date'? tests/cases/conformance/jsx/file.tsx(10,15): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/jsx/file.tsx(10,18): error TS1005: ':' expected. tests/cases/conformance/jsx/file.tsx(10,21): error TS1109: Expression expected. tests/cases/conformance/jsx/file.tsx(10,22): error TS1109: Expression expected. tests/cases/conformance/jsx/file.tsx(11,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/jsx/file.tsx(11,8): error TS1003: Identifier expected. -tests/cases/conformance/jsx/file.tsx(11,9): error TS2304: Cannot find name 'data'. +tests/cases/conformance/jsx/file.tsx(11,9): error TS2552: Cannot find name 'data'. Did you mean 'Date'? tests/cases/conformance/jsx/file.tsx(11,13): error TS1005: ';' expected. tests/cases/conformance/jsx/file.tsx(11,20): error TS1161: Unterminated regular expression literal. @@ -28,7 +28,7 @@ tests/cases/conformance/jsx/file.tsx(11,20): error TS1161: Unterminated regular ~~~~ !!! error TS1005: ';' expected. ~~~~ -!!! error TS2304: Cannot find name 'data'. +!!! error TS2552: Cannot find name 'data'. Did you mean 'Date'? ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ @@ -43,7 +43,7 @@ tests/cases/conformance/jsx/file.tsx(11,20): error TS1161: Unterminated regular ~ !!! error TS1003: Identifier expected. ~~~~ -!!! error TS2304: Cannot find name 'data'. +!!! error TS2552: Cannot find name 'data'. Did you mean 'Date'? ~ !!! error TS1005: ';' expected. diff --git a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt index b93be614f745c..096b19c37179d 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt +++ b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt @@ -3,14 +3,14 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(33,5): error TS2322: Type '"str"' is not assignable to type 'number'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(34,10): error TS2339: Property 'bar' does not exist on type 'B'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(41,10): error TS2339: Property 'bar' does not exist on type 'B'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(66,10): error TS2339: Property 'bar2' does not exist on type 'C1'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(66,10): error TS2551: Property 'bar2' does not exist on type 'C1'. Did you mean 'bar1'? tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(72,10): error TS2339: Property 'bar1' does not exist on type 'C1 | C2'. Property 'bar1' does not exist on type 'C2'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(73,10): error TS2339: Property 'bar2' does not exist on type 'C1 | C2'. Property 'bar2' does not exist on type 'C1'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(85,10): error TS2339: Property 'bar' does not exist on type 'D'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(91,10): error TS2339: Property 'bar' does not exist on type 'D'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(112,10): error TS2339: Property 'bar2' does not exist on type 'E1'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(112,10): error TS2551: Property 'bar2' does not exist on type 'E1'. Did you mean 'bar1'? tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(118,11): error TS2339: Property 'bar1' does not exist on type 'E1 | E2'. Property 'bar1' does not exist on type 'E2'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(119,11): error TS2339: Property 'bar2' does not exist on type 'E1 | E2'. @@ -19,8 +19,8 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru Property 'foo' does not exist on type 'string'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(135,11): error TS2339: Property 'bar' does not exist on type 'string | F'. Property 'bar' does not exist on type 'string'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(160,11): error TS2339: Property 'foo2' does not exist on type 'G1'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(166,11): error TS2339: Property 'foo2' does not exist on type 'G1'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(160,11): error TS2551: Property 'foo2' does not exist on type 'G1'. Did you mean 'foo1'? +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(166,11): error TS2551: Property 'foo2' does not exist on type 'G1'. Did you mean 'foo1'? tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(182,11): error TS2339: Property 'bar' does not exist on type 'H'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(187,11): error TS2551: Property 'foo1' does not exist on type 'H'. Did you mean 'foo'? tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(188,11): error TS2551: Property 'foo2' does not exist on type 'H'. Did you mean 'foo'? @@ -104,7 +104,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru obj5.bar1; obj5.bar2; ~~~~ -!!! error TS2339: Property 'bar2' does not exist on type 'C1'. +!!! error TS2551: Property 'bar2' does not exist on type 'C1'. Did you mean 'bar1'? } var obj6: any; @@ -162,7 +162,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru obj9.bar1; obj9.bar2; ~~~~ -!!! error TS2339: Property 'bar2' does not exist on type 'E1'. +!!! error TS2551: Property 'bar2' does not exist on type 'E1'. Did you mean 'bar1'? } var obj10: any; @@ -224,7 +224,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru obj13.foo1; obj13.foo2; ~~~~ -!!! error TS2339: Property 'foo2' does not exist on type 'G1'. +!!! error TS2551: Property 'foo2' does not exist on type 'G1'. Did you mean 'foo1'? } var obj14: any; @@ -232,7 +232,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru obj14.foo1; obj14.foo2; ~~~~ -!!! error TS2339: Property 'foo2' does not exist on type 'G1'. +!!! error TS2551: Property 'foo2' does not exist on type 'G1'. Did you mean 'foo1'? } // a type with a prototype that has any type From d62622f22a5ee4b32a65cdb9f5fd2c7781760600 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 9 May 2017 13:20:25 -0400 Subject: [PATCH 3/6] Add comments, minimize memory used --- src/compiler/utilities.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index e35f5d51c6098..a1dbc5f9b750b 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4648,6 +4648,7 @@ namespace ts { const TRANSPOSE_COST = 0.95; // Transpositions slightly cheaper than insertion/deletion/substitution to promote transposed errors export const MIN_LEV_DIST = TRANSPOSE_COST; export function dameraulevenshtein(s1: string, s2: string): number { + if (s1.length > s2.length) [s1, s2] = [s2, s1]; // Swap arguments so s2 is always the short one to use minimal memory const rowLength = s2.length + 1; let prevprev: number[] = new Array(rowLength); let previous: number[] = new Array(rowLength); @@ -4657,15 +4658,25 @@ namespace ts { previous[i] = i; } + // For each row in the matrix beyond the first (which is in previous) for (let i = 1; i < s1.length + 1; i++) { + // Set the first element to the row number (representing the distance required to remove the prefix to that point) current[0] = i; + // Then for each element in the row, minimize it's cost based on the cost of editing the string at that point to match the character in the second string for (let j = 1; j < rowLength; j++) { + // Check if the characters match, which makes a 'substitution' or 'transposition' free (since they match, and so aren't really an edit) const eq = s1.charCodeAt(i - 1) === s2.charCodeAt(j - 1); + // First, assume delete is cheapest let min = previous[j] + DELETE_COST; - let tmp = current[j - 1] + INSERT_COST; - if (tmp < min) min = tmp; - if ((tmp = previous[j - 1] + (eq ? 0 : CHANGE_COST)) < min) min = tmp; - if ((tmp = (i > 1 && j > 1 && s1.charCodeAt(i - 1) === s2.charCodeAt(j - 2) && s1.charCodeAt(i - 2) === s2.charCodeAt(j - 1)) ? (prevprev[j - 2] + (eq ? 0 : TRANSPOSE_COST)) : Infinity) < min) min = tmp; + // Then calculate an insertion's cost + let potentialDist = current[j - 1] + INSERT_COST; + // And see if it's cheaper + if (potentialDist < min) min = potentialDist; + // Then check against the cost of a substitution + if ((potentialDist = previous[j - 1] + (eq ? 0 : CHANGE_COST)) < min) min = potentialDist; + // And finally check if a transposition is cheapest if one is present + if ((potentialDist = (i > 1 && j > 1 && s1.charCodeAt(i - 1) === s2.charCodeAt(j - 2) && s1.charCodeAt(i - 2) === s2.charCodeAt(j - 1)) ? (prevprev[j - 2] + (eq ? 0 : TRANSPOSE_COST)) : Infinity) < min) min = potentialDist; + // Then actually set the element to the minimal cost for that edit current[j] = min; } From 085c66edbcbf42695cec7ea98e62154652dce9c2 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 9 May 2017 13:35:16 -0400 Subject: [PATCH 4/6] Increase cost of substitutions --- src/compiler/utilities.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index a1dbc5f9b750b..6f07acb749c44 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4642,7 +4642,7 @@ namespace ts { return identifier.length >= 3 && identifier.charCodeAt(0) === CharacterCodes._ && identifier.charCodeAt(1) === CharacterCodes._ && identifier.charCodeAt(2) === CharacterCodes._ ? identifier.substr(1) : identifier; } - const CHANGE_COST = 1; + const CHANGE_COST = 2; // Make substitutions costly, since when they appear in short strings they're normally obvious errors we don't want to promote const INSERT_COST = 1; const DELETE_COST = 1; const TRANSPOSE_COST = 0.95; // Transpositions slightly cheaper than insertion/deletion/substitution to promote transposed errors From b0f83734d6c4a0b84ba9746d18051b2783aee361 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 9 May 2017 13:35:46 -0400 Subject: [PATCH 5/6] Update baselines for new weights --- ...ExportedAndNonExportedFunctions.errors.txt | 4 +- .../baselines/reference/autoLift2.errors.txt | 12 +++--- ...torWithIncompleteTypeAnnotation.errors.txt | 8 ++-- ...IntypeCheckInvocationExpression.errors.txt | 4 +- .../letDeclarations-scopes2.errors.txt | 4 +- .../reference/parserRealSource7.errors.txt | 16 ++++---- .../reference/scannertest1.errors.txt | 40 +++++++++---------- .../tsxAttributeInvalidNames.errors.txt | 8 ++-- ...nstanceOfByConstructorSignature.errors.txt | 16 ++++---- 9 files changed, 56 insertions(+), 56 deletions(-) diff --git a/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.errors.txt b/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.errors.txt index bf143b9224d7c..96864565d85e9 100644 --- a/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.errors.txt +++ b/tests/baselines/reference/ModuleWithExportedAndNonExportedFunctions.errors.txt @@ -1,4 +1,4 @@ -tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedFunctions.ts(28,13): error TS2551: Property 'fn2' does not exist on type 'typeof A'. Did you mean 'fng'? +tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedFunctions.ts(28,13): error TS2339: Property 'fn2' does not exist on type 'typeof A'. tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAndNonExportedFunctions.ts(29,14): error TS2551: Property 'fng2' does not exist on type 'typeof A'. Did you mean 'fng'? @@ -32,7 +32,7 @@ tests/cases/conformance/internalModules/exportDeclarations/ModuleWithExportedAnd // these should be errors since the functions are not exported var fn2 = A.fn2; ~~~ -!!! error TS2551: Property 'fn2' does not exist on type 'typeof A'. Did you mean 'fng'? +!!! error TS2339: Property 'fn2' does not exist on type 'typeof A'. var fng2 = A.fng2; ~~~~ !!! error TS2551: Property 'fng2' does not exist on type 'typeof A'. Did you mean 'fng'? \ No newline at end of file diff --git a/tests/baselines/reference/autoLift2.errors.txt b/tests/baselines/reference/autoLift2.errors.txt index 4e07c1c92f5f2..63d1c2c3548b3 100644 --- a/tests/baselines/reference/autoLift2.errors.txt +++ b/tests/baselines/reference/autoLift2.errors.txt @@ -1,13 +1,13 @@ tests/cases/compiler/autoLift2.ts(5,14): error TS2339: Property 'foo' does not exist on type 'A'. tests/cases/compiler/autoLift2.ts(5,17): error TS1005: ';' expected. tests/cases/compiler/autoLift2.ts(5,19): error TS2693: 'any' only refers to a type, but is being used as a value here. -tests/cases/compiler/autoLift2.ts(6,14): error TS2551: Property 'bar' does not exist on type 'A'. Did you mean 'baz'? +tests/cases/compiler/autoLift2.ts(6,14): error TS2339: Property 'bar' does not exist on type 'A'. tests/cases/compiler/autoLift2.ts(6,17): error TS1005: ';' expected. tests/cases/compiler/autoLift2.ts(6,19): error TS2693: 'any' only refers to a type, but is being used as a value here. tests/cases/compiler/autoLift2.ts(12,11): error TS2339: Property 'foo' does not exist on type 'A'. -tests/cases/compiler/autoLift2.ts(14,11): error TS2551: Property 'bar' does not exist on type 'A'. Did you mean 'baz'? +tests/cases/compiler/autoLift2.ts(14,11): error TS2339: Property 'bar' does not exist on type 'A'. tests/cases/compiler/autoLift2.ts(16,33): error TS2339: Property 'foo' does not exist on type 'A'. -tests/cases/compiler/autoLift2.ts(18,33): error TS2551: Property 'bar' does not exist on type 'A'. Did you mean 'baz'? +tests/cases/compiler/autoLift2.ts(18,33): error TS2339: Property 'bar' does not exist on type 'A'. ==== tests/cases/compiler/autoLift2.ts (10 errors) ==== @@ -24,7 +24,7 @@ tests/cases/compiler/autoLift2.ts(18,33): error TS2551: Property 'bar' does not !!! error TS2693: 'any' only refers to a type, but is being used as a value here. this.bar: any; ~~~ -!!! error TS2551: Property 'bar' does not exist on type 'A'. Did you mean 'baz'? +!!! error TS2339: Property 'bar' does not exist on type 'A'. ~ !!! error TS1005: ';' expected. ~~~ @@ -40,7 +40,7 @@ tests/cases/compiler/autoLift2.ts(18,33): error TS2551: Property 'bar' does not this.bar = "bar"; ~~~ -!!! error TS2551: Property 'bar' does not exist on type 'A'. Did you mean 'baz'? +!!! error TS2339: Property 'bar' does not exist on type 'A'. [1, 2].forEach((p) => this.foo); ~~~ @@ -48,7 +48,7 @@ tests/cases/compiler/autoLift2.ts(18,33): error TS2551: Property 'bar' does not [1, 2].forEach((p) => this.bar); ~~~ -!!! error TS2551: Property 'bar' does not exist on type 'A'. Did you mean 'baz'? +!!! error TS2339: Property 'bar' does not exist on type 'A'. } diff --git a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt index 5551fe5a9ae4f..1d37b20a3b3e8 100644 --- a/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt +++ b/tests/baselines/reference/constructorWithIncompleteTypeAnnotation.errors.txt @@ -64,12 +64,12 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,21): error T tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,44): error TS2369: A parameter property is only allowed in a constructor implementation. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(254,69): error TS1110: Type expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,9): error TS1128: Declaration or statement expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,16): error TS2552: Cannot find name 'Overloads'. Did you mean 'Overloading'? +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,16): error TS2304: Cannot find name 'Overloads'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,26): error TS2304: Cannot find name 'value'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,31): error TS1005: ',' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(256,33): error TS2693: 'string' only refers to a type, but is being used as a value here. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,9): error TS1128: Declaration or statement expected. -tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,16): error TS2552: Cannot find name 'Overloads'. Did you mean 'Overloading'? +tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,16): error TS2304: Cannot find name 'Overloads'. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,27): error TS1135: Argument expression expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,33): error TS1005: '(' expected. tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(257,35): error TS2693: 'string' only refers to a type, but is being used as a value here. @@ -480,7 +480,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS ~~~~~~ !!! error TS1128: Declaration or statement expected. ~~~~~~~~~ -!!! error TS2552: Cannot find name 'Overloads'. Did you mean 'Overloading'? +!!! error TS2304: Cannot find name 'Overloads'. ~~~~~ !!! error TS2304: Cannot find name 'value'. ~ @@ -491,7 +491,7 @@ tests/cases/compiler/constructorWithIncompleteTypeAnnotation.ts(261,1): error TS ~~~~~~ !!! error TS1128: Declaration or statement expected. ~~~~~~~~~ -!!! error TS2552: Cannot find name 'Overloads'. Did you mean 'Overloading'? +!!! error TS2304: Cannot find name 'Overloads'. ~~~~~ !!! error TS1135: Argument expression expected. ~ diff --git a/tests/baselines/reference/crashIntypeCheckInvocationExpression.errors.txt b/tests/baselines/reference/crashIntypeCheckInvocationExpression.errors.txt index e1bcb5fcb6908..a1f5afbde13f8 100644 --- a/tests/baselines/reference/crashIntypeCheckInvocationExpression.errors.txt +++ b/tests/baselines/reference/crashIntypeCheckInvocationExpression.errors.txt @@ -1,5 +1,5 @@ tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(6,28): error TS2304: Cannot find name 'task'. -tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(8,18): error TS2552: Cannot find name 'path'. Did you mean 'Math'? +tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(8,18): error TS2304: Cannot find name 'path'. tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(9,19): error TS2347: Untyped function calls may not accept type arguments. tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(10,50): error TS2304: Cannot find name 'moduleType'. @@ -16,7 +16,7 @@ tests/cases/compiler/crashIntypeCheckInvocationExpression.ts(10,50): error TS230 var folder = path.join(), ~~~~ -!!! error TS2552: Cannot find name 'path'. Did you mean 'Math'? +!!! error TS2304: Cannot find name 'path'. fileset = nake.fileSetSync(folder) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2347: Untyped function calls may not accept type arguments. diff --git a/tests/baselines/reference/letDeclarations-scopes2.errors.txt b/tests/baselines/reference/letDeclarations-scopes2.errors.txt index 617f69fd661df..5da8d99d397c1 100644 --- a/tests/baselines/reference/letDeclarations-scopes2.errors.txt +++ b/tests/baselines/reference/letDeclarations-scopes2.errors.txt @@ -1,6 +1,6 @@ tests/cases/compiler/letDeclarations-scopes2.ts(8,5): error TS2552: Cannot find name 'local2'. Did you mean 'local'? tests/cases/compiler/letDeclarations-scopes2.ts(20,5): error TS2552: Cannot find name 'local2'. Did you mean 'local'? -tests/cases/compiler/letDeclarations-scopes2.ts(23,1): error TS2552: Cannot find name 'local'. Did you mean 'global'? +tests/cases/compiler/letDeclarations-scopes2.ts(23,1): error TS2304: Cannot find name 'local'. tests/cases/compiler/letDeclarations-scopes2.ts(25,1): error TS2304: Cannot find name 'local2'. @@ -33,7 +33,7 @@ tests/cases/compiler/letDeclarations-scopes2.ts(25,1): error TS2304: Cannot find local; // Error ~~~~~ -!!! error TS2552: Cannot find name 'local'. Did you mean 'global'? +!!! error TS2304: Cannot find name 'local'. global; // OK local2; // Error ~~~~~~ diff --git a/tests/baselines/reference/parserRealSource7.errors.txt b/tests/baselines/reference/parserRealSource7.errors.txt index 51d8a1945e5e5..1261d7b5f0655 100644 --- a/tests/baselines/reference/parserRealSource7.errors.txt +++ b/tests/baselines/reference/parserRealSource7.errors.txt @@ -71,7 +71,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(206,48): error T tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(206,66): error TS2304: Cannot find name 'DualStringHashTable'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(206,90): error TS2304: Cannot find name 'StringHashTable'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(206,113): error TS2304: Cannot find name 'StringHashTable'. -tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(207,31): error TS2552: Cannot find name 'ModuleType'. Did you mean 'moduleDecl'? +tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(207,31): error TS2304: Cannot find name 'ModuleType'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(209,42): error TS2304: Cannot find name 'TypeFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(211,39): error TS2304: Cannot find name 'ScopedMembers'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(211,57): error TS2304: Cannot find name 'DualStringHashTable'. @@ -100,7 +100,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(250,82): error T tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(251,38): error TS2304: Cannot find name 'ScopedMembers'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(251,56): error TS2304: Cannot find name 'DualStringHashTable'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(251,107): error TS2304: Cannot find name 'StringHashTable'. -tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(253,27): error TS2552: Cannot find name 'ModuleType'. Did you mean 'moduleDecl'? +tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(253,27): error TS2304: Cannot find name 'ModuleType'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(255,38): error TS2304: Cannot find name 'TypeFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(272,33): error TS2304: Cannot find name 'SymbolFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(276,33): error TS2304: Cannot find name 'SymbolFlags'. @@ -196,7 +196,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(476,57): error T tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(477,29): error TS2304: Cannot find name 'ValueLocation'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(478,29): error TS2304: Cannot find name 'hasFlag'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(478,55): error TS2304: Cannot find name 'VarFlags'. -tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(480,21): error TS2304: Cannot find name 'FieldSymbol'. +tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(480,21): error TS2552: Cannot find name 'FieldSymbol'. Did you mean 'fieldSymbol'? tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(482,34): error TS2304: Cannot find name 'hasFlag'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(482,60): error TS2304: Cannot find name 'VarFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(492,30): error TS2304: Cannot find name 'getTypeLink'. @@ -218,7 +218,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(507,26): error T tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(507,52): error TS2304: Cannot find name 'ASTFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(518,22): error TS2304: Cannot find name 'FieldSymbol'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(531,29): error TS2304: Cannot find name 'ValueLocation'. -tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(533,21): error TS2304: Cannot find name 'FieldSymbol'. +tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(533,21): error TS2552: Cannot find name 'FieldSymbol'. Did you mean 'fieldSymbol'? tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(535,53): error TS2304: Cannot find name 'VarFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(535,75): error TS2304: Cannot find name 'VarFlags'. tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(539,38): error TS2304: Cannot find name 'SymbolFlags'. @@ -658,7 +658,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(828,13): error T !!! error TS2304: Cannot find name 'StringHashTable'. modType = new ModuleType(enclosedTypes, ambientEnclosedTypes); ~~~~~~~~~~ -!!! error TS2552: Cannot find name 'ModuleType'. Did you mean 'moduleDecl'? +!!! error TS2304: Cannot find name 'ModuleType'. if (isEnum) { modType.typeFlags |= TypeFlags.IsEnum; ~~~~~~~~~ @@ -762,7 +762,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(828,13): error T modType = new ModuleType(enclosedTypes, ambientEnclosedTypes); ~~~~~~~~~~ -!!! error TS2552: Cannot find name 'ModuleType'. Did you mean 'moduleDecl'? +!!! error TS2304: Cannot find name 'ModuleType'. if (isEnum) { modType.typeFlags |= TypeFlags.IsEnum; ~~~~~~~~~ @@ -1181,7 +1181,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(828,13): error T var fieldSymbol = new FieldSymbol(argDecl.id.text, argDecl.minChar, ~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'FieldSymbol'. +!!! error TS2552: Cannot find name 'FieldSymbol'. Did you mean 'fieldSymbol'? context.checker.locationInfo.unitIndex, !hasFlag(argDecl.varFlags, VarFlags.Readonly), ~~~~~~~ @@ -1278,7 +1278,7 @@ tests/cases/conformance/parser/ecmascript5/parserRealSource7.ts(828,13): error T var fieldSymbol = new FieldSymbol(varDecl.id.text, varDecl.minChar, ~~~~~~~~~~~ -!!! error TS2304: Cannot find name 'FieldSymbol'. +!!! error TS2552: Cannot find name 'FieldSymbol'. Did you mean 'fieldSymbol'? context.checker.locationInfo.unitIndex, (varDecl.varFlags & VarFlags.Readonly) == VarFlags.None, ~~~~~~~~ diff --git a/tests/baselines/reference/scannertest1.errors.txt b/tests/baselines/reference/scannertest1.errors.txt index 8da2524209483..fce2a0b292a22 100644 --- a/tests/baselines/reference/scannertest1.errors.txt +++ b/tests/baselines/reference/scannertest1.errors.txt @@ -1,18 +1,18 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(1,1): error TS6053: File 'tests/cases/conformance/scanner/ecmascript5/References.ts' not found. -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(5,21): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(5,47): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(5,21): error TS2304: Cannot find name 'CharacterCodes'. +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(5,47): error TS2304: Cannot find name 'CharacterCodes'. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(9,16): error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'? -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(10,22): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(10,47): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(11,22): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(11,47): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(10,22): error TS2304: Cannot find name 'CharacterCodes'. +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(10,47): error TS2304: Cannot find name 'CharacterCodes'. +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(11,22): error TS2304: Cannot find name 'CharacterCodes'. +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(11,47): error TS2304: Cannot find name 'CharacterCodes'. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(15,9): error TS2304: Cannot find name 'Debug'. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(15,22): error TS2662: Cannot find name 'isHexDigit'. Did you mean the static member 'CharacterInfo.isHexDigit'? tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(16,16): error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'? -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(17,20): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(18,21): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(18,46): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? -tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(19,23): error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(17,20): error TS2304: Cannot find name 'CharacterCodes'. +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(18,21): error TS2304: Cannot find name 'CharacterCodes'. +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(18,46): error TS2304: Cannot find name 'CharacterCodes'. +tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(19,23): error TS2304: Cannot find name 'CharacterCodes'. tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(20,23): error TS2304: Cannot find name 'CharacterCodes'. @@ -25,9 +25,9 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(20,23): error TS2304 public static isDecimalDigit(c: number): boolean { return c >= CharacterCodes._0 && c <= CharacterCodes._9; ~~~~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +!!! error TS2304: Cannot find name 'CharacterCodes'. ~~~~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +!!! error TS2304: Cannot find name 'CharacterCodes'. } public static isHexDigit(c: number): boolean { @@ -36,14 +36,14 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(20,23): error TS2304 !!! error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'? (c >= CharacterCodes.A && c <= CharacterCodes.F) || ~~~~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +!!! error TS2304: Cannot find name 'CharacterCodes'. ~~~~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +!!! error TS2304: Cannot find name 'CharacterCodes'. (c >= CharacterCodes.a && c <= CharacterCodes.f); ~~~~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +!!! error TS2304: Cannot find name 'CharacterCodes'. ~~~~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +!!! error TS2304: Cannot find name 'CharacterCodes'. } public static hexValue(c: number): number { @@ -57,15 +57,15 @@ tests/cases/conformance/scanner/ecmascript5/scannertest1.ts(20,23): error TS2304 !!! error TS2662: Cannot find name 'isDecimalDigit'. Did you mean the static member 'CharacterInfo.isDecimalDigit'? ? (c - CharacterCodes._0) ~~~~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +!!! error TS2304: Cannot find name 'CharacterCodes'. : (c >= CharacterCodes.A && c <= CharacterCodes.F) ~~~~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +!!! error TS2304: Cannot find name 'CharacterCodes'. ~~~~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +!!! error TS2304: Cannot find name 'CharacterCodes'. ? c - CharacterCodes.A + 10 ~~~~~~~~~~~~~~ -!!! error TS2552: Cannot find name 'CharacterCodes'. Did you mean 'CharacterInfo'? +!!! error TS2304: Cannot find name 'CharacterCodes'. : c - CharacterCodes.a + 10; ~~~~~~~~~~~~~~ !!! error TS2304: Cannot find name 'CharacterCodes'. diff --git a/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt b/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt index d6d7b2f277a7d..0607a01a11c34 100644 --- a/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt +++ b/tests/baselines/reference/tsxAttributeInvalidNames.errors.txt @@ -1,13 +1,13 @@ tests/cases/conformance/jsx/file.tsx(10,8): error TS1003: Identifier expected. tests/cases/conformance/jsx/file.tsx(10,10): error TS1005: ';' expected. -tests/cases/conformance/jsx/file.tsx(10,10): error TS2552: Cannot find name 'data'. Did you mean 'Date'? +tests/cases/conformance/jsx/file.tsx(10,10): error TS2304: Cannot find name 'data'. tests/cases/conformance/jsx/file.tsx(10,15): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/jsx/file.tsx(10,18): error TS1005: ':' expected. tests/cases/conformance/jsx/file.tsx(10,21): error TS1109: Expression expected. tests/cases/conformance/jsx/file.tsx(10,22): error TS1109: Expression expected. tests/cases/conformance/jsx/file.tsx(11,1): error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. tests/cases/conformance/jsx/file.tsx(11,8): error TS1003: Identifier expected. -tests/cases/conformance/jsx/file.tsx(11,9): error TS2552: Cannot find name 'data'. Did you mean 'Date'? +tests/cases/conformance/jsx/file.tsx(11,9): error TS2304: Cannot find name 'data'. tests/cases/conformance/jsx/file.tsx(11,13): error TS1005: ';' expected. tests/cases/conformance/jsx/file.tsx(11,20): error TS1161: Unterminated regular expression literal. @@ -28,7 +28,7 @@ tests/cases/conformance/jsx/file.tsx(11,20): error TS1161: Unterminated regular ~~~~ !!! error TS1005: ';' expected. ~~~~ -!!! error TS2552: Cannot find name 'data'. Did you mean 'Date'? +!!! error TS2304: Cannot find name 'data'. ~~~~ !!! error TS2362: The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type. ~ @@ -43,7 +43,7 @@ tests/cases/conformance/jsx/file.tsx(11,20): error TS1161: Unterminated regular ~ !!! error TS1003: Identifier expected. ~~~~ -!!! error TS2552: Cannot find name 'data'. Did you mean 'Date'? +!!! error TS2304: Cannot find name 'data'. ~ !!! error TS1005: ';' expected. diff --git a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt index 096b19c37179d..b93be614f745c 100644 --- a/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt +++ b/tests/baselines/reference/typeGuardsWithInstanceOfByConstructorSignature.errors.txt @@ -3,14 +3,14 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(33,5): error TS2322: Type '"str"' is not assignable to type 'number'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(34,10): error TS2339: Property 'bar' does not exist on type 'B'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(41,10): error TS2339: Property 'bar' does not exist on type 'B'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(66,10): error TS2551: Property 'bar2' does not exist on type 'C1'. Did you mean 'bar1'? +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(66,10): error TS2339: Property 'bar2' does not exist on type 'C1'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(72,10): error TS2339: Property 'bar1' does not exist on type 'C1 | C2'. Property 'bar1' does not exist on type 'C2'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(73,10): error TS2339: Property 'bar2' does not exist on type 'C1 | C2'. Property 'bar2' does not exist on type 'C1'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(85,10): error TS2339: Property 'bar' does not exist on type 'D'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(91,10): error TS2339: Property 'bar' does not exist on type 'D'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(112,10): error TS2551: Property 'bar2' does not exist on type 'E1'. Did you mean 'bar1'? +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(112,10): error TS2339: Property 'bar2' does not exist on type 'E1'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(118,11): error TS2339: Property 'bar1' does not exist on type 'E1 | E2'. Property 'bar1' does not exist on type 'E2'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(119,11): error TS2339: Property 'bar2' does not exist on type 'E1 | E2'. @@ -19,8 +19,8 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru Property 'foo' does not exist on type 'string'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(135,11): error TS2339: Property 'bar' does not exist on type 'string | F'. Property 'bar' does not exist on type 'string'. -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(160,11): error TS2551: Property 'foo2' does not exist on type 'G1'. Did you mean 'foo1'? -tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(166,11): error TS2551: Property 'foo2' does not exist on type 'G1'. Did you mean 'foo1'? +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(160,11): error TS2339: Property 'foo2' does not exist on type 'G1'. +tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(166,11): error TS2339: Property 'foo2' does not exist on type 'G1'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(182,11): error TS2339: Property 'bar' does not exist on type 'H'. tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(187,11): error TS2551: Property 'foo1' does not exist on type 'H'. Did you mean 'foo'? tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstructorSignature.ts(188,11): error TS2551: Property 'foo2' does not exist on type 'H'. Did you mean 'foo'? @@ -104,7 +104,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru obj5.bar1; obj5.bar2; ~~~~ -!!! error TS2551: Property 'bar2' does not exist on type 'C1'. Did you mean 'bar1'? +!!! error TS2339: Property 'bar2' does not exist on type 'C1'. } var obj6: any; @@ -162,7 +162,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru obj9.bar1; obj9.bar2; ~~~~ -!!! error TS2551: Property 'bar2' does not exist on type 'E1'. Did you mean 'bar1'? +!!! error TS2339: Property 'bar2' does not exist on type 'E1'. } var obj10: any; @@ -224,7 +224,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru obj13.foo1; obj13.foo2; ~~~~ -!!! error TS2551: Property 'foo2' does not exist on type 'G1'. Did you mean 'foo1'? +!!! error TS2339: Property 'foo2' does not exist on type 'G1'. } var obj14: any; @@ -232,7 +232,7 @@ tests/cases/conformance/expressions/typeGuards/typeGuardsWithInstanceOfByConstru obj14.foo1; obj14.foo2; ~~~~ -!!! error TS2551: Property 'foo2' does not exist on type 'G1'. Did you mean 'foo1'? +!!! error TS2339: Property 'foo2' does not exist on type 'G1'. } // a type with a prototype that has any type From ed873e36030afffe5cec20f2e0de254458d822a1 Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Tue, 9 May 2017 13:39:11 -0400 Subject: [PATCH 6/6] Use destrucuring for multi-swap sugar to clean up code --- src/compiler/utilities.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/compiler/utilities.ts b/src/compiler/utilities.ts index 6f07acb749c44..a1a3dfe412414 100644 --- a/src/compiler/utilities.ts +++ b/src/compiler/utilities.ts @@ -4681,10 +4681,7 @@ namespace ts { } // shift current back to previous, and then reuse previous' array - const tmp = prevprev; - prevprev = previous; - previous = current; - current = tmp; + [prevprev, previous, current] = [previous, current, prevprev]; } return previous[rowLength - 1];